martedì 8 aprile 2014

Create ext2 filesystem file with the directory contents

The genext2fs tool is a great tool if you use QEmu!
Without the superuser account, the following lines shows you how to create a ext2 filesystem file with the directory contents.

# set the destination directory
export DESTDIR=/home/davidez/projects/arm-data

# generate arm-data.ext2 file with 10% free space
genext2fs -b `du -k $DESTDIR | tail -n -1 | awk '{ print $1 + $1 * 0.1 }'` -d $DESTDIR $DESTDIR.ext2