using bzip2 to compress man-pages

Brian Candler B.Candler at
Fri Sep 23 06:59:21 PDT 2005

On Thu, Sep 22, 2005 at 04:52:53PM -0400, Mikhail Teterin wrote:
> The space-saving potential can substantial, however -- see below. Being able 
> to stick us useful root filesystem (with /usr) onto a USB key can be useful 
> for some applications.

Of course, if space is that critical you don't need to install the
'manpages' distribution set in the first place.

However I have another suggestion. For USB pen drives, if you don't mind
your /usr filesystem being read-only then you can get a big benefit from
using geom_uzip. I've just tried it on the manpages:

# du -sk /usr/share/man
17978   /usr/share/man
# dd if=/dev/zero of=test.ufs bs=1k count=50k
# mdconfig -a -t vnode -f test.ufs -u 0
# bsdlabel -w md0 auto
# newfs -m 0 -i 1024 md0c
# mount /dev/md0c /mnt
# tar -C /usr/share/man -cf - . | tar -C /mnt -xf -  # note, lots of hard links
# df -k
Filesystem                 1K-blocks     Used   Avail Capacity  Mounted on
/dev/md0c                      44526    17980   26546    40%    /mnt

# umount /mnt
# mdconfig -d -u 0
# mkuzip test.ufs
# ls -l test.ufs.uzip
-rw-r--r--  1 root  brian  12966912 Sep 23 14:42 test.ufs.uzip

# mdconfig -a -t vnode -f test.ufs.uzip -u 0
# mount -r /dev/md0.uzip /mnt
# df -k
/dev/md0.uzip                  44526    17980   26546    40%    /mnt

That's a reduction from 17978K to 12663K, or 30%, even though all these
files are already compressed (apart from /usr/share/man/whatis, which is
only 210K). I expect that's due to the partial sectors at the end of all
these small files.

I've never tried booting from a geom_uzip filesystem, but I don't see why it
shouldn't work :-)



More information about the freebsd-current mailing list