gzip compression problems

Erik Cederstrand erik at cederstrand.dk
Thu Sep 27 03:45:10 PDT 2007


Hi!

I'm trying to create a custom disk image for installing on a server. The 
plan is to PXE boot the server and dd the image to the hard-disk of the 
server.

The gzipped files I need for the server are 45MB. However, when I create 
a 4GB image, stick the same files in there and gzip the image, the 
resulting file is 251MB.

Most of the image is just empty space, so I was expecting the gzipped 
image to be roughly 45MB. What's going on?

I used the following commands to create the image:

# dd if=/dev/zero of=/path/to/diskimg bs=1k count=4m
# mdconfig -a -t vnode -f /path/to/diskimg -u 4
# fdisk -BI -b /boot/mbr md4
# bsdlabel -B -b /boot/boot -R md4s1 /path/to/disklayout
# newfs /dev/md4s1a
# mount /dev/md4s1a /mnt/
# make installworld DESTDIR=/mnt
# make distribution DESTDIR=/mnt
# make installkernel DESTDIR=/mnt
# umount /mnt
# fsck -t ufs /dev/md4s1a
# mdconfig -d -u 4

The contents of /path/to/disklayout:
    # /dev/md4s1:
    8 partitions:
    #    size   offset    fstype   [fsize bsize bps/cpg]
    a:     3G       16    4.2BSD     2048 16384    8
    b:   500M        *      swap
    c:      *        *    unused        0     0

Thanks,
Erik


More information about the freebsd-questions mailing list