2. Why would I (not) want FreeBSD From Scratch?

This is a legitimate question. We have sysinstall and the well known way to compile the kernel and the userland tools.

The problem with sysinstall is that it is severely limited in what, where and how it can install.

The well known way to build and install the world, as described in the Handbook, by default replaces the existing system. Only the kernel and modules are saved. System binaries, headers and a lot of other files are overwritten; obsolete files are still present and can cause surprises. If the upgrade fails for any reason, it may be hard or even impossible to restore the previous state of the system.

FreeBSD From Scratch solves all these problems. The strategy is simple: use a running system to install a new system under an empty directory tree, while new partitions are mounted appropriately in that tree. Many config files can be copied to the appropriate place and mergemaster(8) can take care of those that cannot. Arbitrary post-configuration of the new system can be done from within the old system, up to the point where you can chroot to the new system. In other words, we go through three stages, where each stage consists of either running a shell script or invoking make:

  1. stage_1.sh: Create a new bootable system under an empty directory and merge or copy as many files as are necessary. Then boot the new system.

  2. stage_2.sh: Install desired ports.

  3. stage_3.mk: Do post-configuration for software installed in previous stage.

Once you have used FreeBSD From Scratch to build a second system and found it works satisfactorily for a couple of weeks, you can then use it again to reinstall the original system. From now on, whenever you feel like an update is in order, you simply toggle the partitions you want to wipe and reinstall.

Maybe you have heard of or even tried Linux From Scratch, or LFS for short. LFS also describes how to build and install a system from scratch in empty partitions using a running system. The focus in LFS seems to be to show the role of each system component (such as kernel, compiler, devices, shell, terminal database, etc) and the details of each component's installation. FreeBSD From Scratch does not go into that much detail. My goal is to provide an automated and complete installation, not explaining all the gory details that go on under the hood when making the world. In case you want to explore FreeBSD at this level of detail, start looking at /usr/src/Makefile and follow the actions of a make buildworld.

There are also downsides in the approach taken by FreeBSD From Scratch that you should bear in mind.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.