|
|
Posted Apr 15, 2008 at 6:14:27 PM
Subject: Create .img of a directory
I have a directory say for example /tmp/stuff, and I want to create an .img (stuff.img) file of this stuff directory. Can some one please help me to achieve this? Thanks
|
tophandcwby
Joined Apr 10, 2008 Posts: 81
Other Topics
|
Posted:
Apr 15, 2008 6:31:45 PM
Subject: Create .img of a directory
There are short cuts to this, but this is how I'd do it.
#make sure the loop driver is installed
modprobe loop
#determine the amount of memory space I need
cd dir_of_interest
du
cd
dd if=/dev/zero of=new_img bs=1024 count=#kilobytes needed
losetup /dev/loop0 new_img
mkfs.ext3 /dev/loop0
mount /dev/loop0 /mnt
cp -a dir_of_interest /mnt/
umount /mnt
losetup -d /dev/loop0
Now you have the img of dir_of_interest.
|