Recreating the FreeBSD Installation Disks

Roland Smith rsmith at
Wed Aug 27 22:04:46 UTC 2014

On Wed, Aug 27, 2014 at 09:25:17AM -0500, Martin G. McCormick wrote:
> 	I have been asking lots of questions recently about
> whether the procedure for building a custom FreeBSD installation
> CD has changed and it apparently has not but the problem I am
> having is not hard to define.
> The original image downloaded from is:
> FreeBSD-9.1-RELEASE-amd64-disc1.iso and it is
> 718862336 bytes large.
> I mounted it on a FreeBSD9 system as follows:
> ##Set up memory disk.
> # mdconfig -f FreeBSD-9.1-RELEASE-amd64-disc1.iso -u 1
> ##Mount it.
> #mount -t cd9660 /dev/md1 /mnt2
> 	Everything looks normal if you ls /mnt2.
> If one was to use mkisofs with /mnt2 as the top of the tree, a
> new iso image file should appear somewhere that is about the
> same size as the starting ISO file. As a test to see if this
> happens, I did the following:
> #   mkisofs -J -R -V customBSD -no-emul-boot -b boot/cdboot -iso-level 3 -o \
> #/home/martin/tmp/serialcd64.iso .
> #ls -l /home/martin/serialcd64.iso
> -rw-r--r--  1 root  martin  833892352 Aug 26 10:48 serialcd64.iso
> Man! I sure wish my pay check could do that after a week of
> living.
> 	I know that hard links will make tar and rsync produce
> larger outputs if not called correctly. My understanding is that
> hard links are multiple sets of inode numbers pointing to the
> same files so they are hard to mechanically distinguish from
> actual disk space being occupied by the same data in more than
> one spot.

Looking at the mkisofs manpage, it *should* detect hard links by default. Does
using the `-cache-inodes` option make any difference?

> 	When one needs to make a custom CD, the extremely
> difficult part is recreating the steps that were used to
> originally build the image.

From the Makefile in /usr/src/release, it seems that you have to run
`make buildworld buildkernel` from /usr/src, and then `make dvdrom` from

Another avenue to pursue is to mount the existing CD image using md, and use
nullfs and unionfs to create a writable filesystem. I've used that trick to
e.g. share /usr/ports in different jails without copying the whole thing:

After you've modified/added what you want, you can create a new DVD.

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 5753 3324 1661 B0FE 8D93  FCED 40F6 D5DC A38A 33E0 (keyID: A38A33E0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the freebsd-questions mailing list