using /dev/zero to create image file in linux

dd if=/dev/zero of=imagefile.img bs=512 count=200 
(creating a 100mb image file) 
/sbin/mkfs.ext3 imagefile.img 
(formatting with ext3 type of filesystem) 
Now you have an image file you can mount using the loopback device: 
sudo mount -t ext3 imagefile.img mountdir/ -o loop 
sudo chown username:username mountdir 
now you have the image mounted at mountdir. put the contents you want into it.

Leave a Reply

Your email address will not be published.