make_ext3fs?

make_ext3fs?

Nadav Har'El nyh at math.technion.ac.il
Tue Nov 15 09:26:03 IST 2011


On Tue, Nov 15, 2011, Shachar Shemesh wrote about "make_ext3fs?":
> Hi all,
> 
> Android uses a tool called "make_ext4fs". You give it a file system size
> and a directory, and it creates a file of the specified size that
> contains the content of the directory as an EXT4 file system (for
> loopback mount or dd purposes).

I don't know of a specific tool like this, but it sounds like something
which can easily be done with a few line shell script.

E.g., something like (untested!)

IMAGE=imagefile
SIZE=300M
# You can also use dd or something else to create the zero-filled file
qemu-img create -f raw $IMAGE $SIZE
LOOPDEV=$(/sbin/losetup -f)
/sbin/losetup $LOOPDEV $IMAGE
# Note: it might be possible (I didn't check) to give $IMAGE directly to
# mkfs.ext3, and no need to mount it on loop device first..
mkfs.ext3 -m 0 $LOOPDEV
mkdir tmpmount
mount $LOOPDEV tmpmount
cp -a $SOURCEDIR tmpmount/
umount tmpmount
rmdir tmpmount
/sbin/losetup -d $LOOPDEV


-- 
Nadav Har'El                        |                   Tuesday, Nov 15 2011, 
nyh at math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |I don't eat snails. I prefer fast food.
http://nadav.harel.org.il           |



More information about the Linux-il mailing list