I need to create and populate EXT2 image files; that is, files that
contain an EXT2 image and could be mounted like so:
mount -o loop ext2.img /mnt
I know how to create the file (dd) and format it as an EXT2 image
(mke2fs), but here's the catch: I need to be able to do the equivalent
of mkdir, cp, chown, chmod, and chgrp *WITHOUT MOUNTING THE IMAGE FILE*,
and to be able to do all of this from a script.
Ideally it would look something like this:
#!/bin/bash
. . .
dd if=/dev/zero of=ext2.img bs=1024 32768"
mke2fs -F ext2.img
. . .
magic_ext2_prog -f ext2.img mkdir /another-dir
for f in some-dir/* ; do
magic_ext2_prog -f ext2.img cp $f /another-dir
magic_ext2_prog -f ext2.img chown adamm:adamm /another-dir/$f
magic_ext2_prog -f ext2.img chmod 0644 /another-dir/$f
done
I know about the program "debugfs," and it will let me do some of what I
want (mainly using the "-R request" option), but the man page warns that
debugfs isn't really meant for this and has some trough edges (which
worries me a bit); also (and more problematic), I don't see a way to use
the "modify_inode" request from "-R".
Does anyone know of other tools that will let me populate an EXT2 image
file, again, *WITHOUT* mounting the file?
Thanks,
AdamM
_______________________________________________
Discuss mailing list
[email protected]
http://lopsa.org/cgi-bin/mailman/listinfo/discuss
This list provided by the League of Professional System Administrators
http://lopsa.org/