1 #!/bin/bash 2 set -e 3 4 # Given a path, make an ext4 image out of it, store it in $2 5 dd if=/dev/zero of=$2 bs=4k count=$((256 * 1024 * 2)) 6 mkfs.ext4 $2 7 8 OUT=`mktemp -d` 9 mount -o loop $2 $OUT/ 10 rsync -ra $1/ $OUT/ 11 umount $OUT/ 12