Skip to Content.
Sympa Menu

baslinux - Re: [BL] BasLinux Digest, Vol 37, Issue 9

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Christian Brandt <brandtc AT psi5.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] BasLinux Digest, Vol 37, Issue 9
  • Date: Tue, 11 Apr 2006 23:34:41 +0100

Ian Scott schrieb:

One way to do this would be to create a new fs.img, cat /dev/zero into it,
and cp -a all the contents to it. Then all unused bytes would be zero.
Send instant messages to your online friends http://uk.messenger.yahoo.com

Using something like this should do the trick:

mount fs.img /mnt -o loop
cat /dev/zero >/mnt/zero
rm /mnt/zero
umount /mnt

But even more effective should be recreating a new image and then copying the contents into it again:

dd if=/dev/zero bs=512 of=fs.img count=howmanyblocks
mkfs.ext2 -m1 fsnew.img
mkdir /fsnew /fsold
mount fsnew.img /fsnew -o loop
cd /fsold
tar -cf - | (cd /fsold && tar -xvpf - )
umount /fsnew /fsold

The later one takes a bit more time but gives also slightly better results, that is 2% on a 5MB-file.

Read the manual of mkfs.ext2 as you might need smaller inodes or different root-reserves. You might also try ROMFS or minix instead which have a little less overhead. But you need a kernel with support for it.

Christian Brandt




Archive powered by MHonArc 2.6.24.

Top of Page