View Single Post
Posts: 323 | Thanked: 180 times | Joined on Oct 2009 @ Gent, Belgium
#343
gunzip bt5.img.gz

mv bt5.img bt5.old.img

dd if=/dev/zero of=bt5.img bs=4k count=900000
mke2fs -F -i 8192 bt5.img

mkdir bt5old bt5new
mount -o loop bt5.old.img bt5old
mount -o loop bt5.img bt5new
cd bt5old
cp -rp * ../bt5new
that little script from the link is creating a new file based filesystem (of 3.6 GB = 900000 x 4KB), by creating an empty file with the right size and then converting it to a FAT filesystem.

It continues by mounting both old and new files and copying all files from the old file(filesystem) to the newly, smaller created one.

So it seems the old file/filesystem was initially created too big for the total size of the files it had to contain. No data is lost!

just for your info
 

The Following User Says Thank You to Netweaver For This Useful Post: