3 Preparation - mfsBSD

Before FreeBSD may be installed on the target system, it is necessary to build the minimal FreeBSD operating system image which will boot from the hard drive. This way the new system can be accessed from the network, and the rest of the installation can be done without remote access to the system console.

The mfsBSD tool-set can be used to build a tiny FreeBSD image. As the name of mfsBSD suggests (“mfs” means “memory file system”), the resulting image runs entirely from a ramdisk. Thanks to this feature, the manipulation of hard drives will not be limited, therefore it will be possible to install a complete FreeBSD operating system. The home page of mfsBSD, at http://people.freebsd.org/~mm/mfsbsd/, includes pointers to the latest release of the toolset.

Please note that the internals of mfsBSD and how it all fits together is beyond the scope of this article. The interested reader should consult the original documentation of mfsBSD for more details.

Download and extract the latest mfsBSD release and change your working directory to the directory where the mfsBSD scripts will reside:

# fetch http://people.freebsd.org/~mm/mfsbsd/mfsbsd-latest.tar.gz
# tar xvzf mfsbsd-1.0-beta1.tar.gz
# cd mfsbsd-1.0-beta1/

3.1 Configuration of mfsBSD

Before booting mfsBSD, a few important configuration options have to be set. The most important that we have to get right is, naturally, the network setup. The most suitable method to configure networking options depends on whether we know beforehand the type of the network interface we will use, and the network interface driver to be loaded for our hardware. We will see how mfsBSD can be configured in either case.

Another important thing to set is the root password. This can be done by editing the conf/rootpw.conf file. Please keep in mind that the file will contain your password in the plain text, thus we do not recommend to use real password here. Nevertheless, this is just a temporary one-time password which can be later changed in a live system.

3.1.1 The conf/interfaces.conf method

When the installed network interface card is unknown, we can use the auto-detection features of mfsBSD. The startup scripts of mfsBSD can detect the correct driver to use, based on the MAC address of the interface, if we set the following options in conf/interfaces.conf:

initconf_interfaces="ext1"
initconf_mac_ext1="00:00:00:00:00:00"
initconf_ip_ext1="192.168.0.2"
initconf_netmask_ext1="255.255.255.0"

Do not forget to add the defaultrouter information to the conf/rc.conf file:

defaultrouter="192.168.0.1"

3.1.2 The conf/rc.conf method

When the network interface driver is known, it is more convenient to use the conf/rc.conf file for networking options. The syntax of this file is the same as the one used in the standard rc.conf(5) file of FreeBSD.

For example, if you know that a re(4) network interface is going to be available, you can set the following options in conf/rc.conf:

defaultrouter="192.168.0.1"
ifconfig_re0="inet 192.168.0.2 netmask 255.255.255.0"

3.2 Building an mfsBSD image

The process of building an mfsBSD image is pretty straightforward.

The first step is to mount the FreeBSD installation CD, or the installation ISO image to /cdrom. For the sake of example, in this article we will assume that you have downloaded the FreeBSD 7.0-RELEASE ISO. Mounting this ISO image to the /cdrom directory is easy with the mdconfig(8) utility:

# mdconfig -a -t vnode -u 10 -f 7.0-RELEASE-amd64-disc1.iso
# mount_cd9660 /dev/md10 /cdrom

Next, build the bootable mfsBSD image:

# make BASE=/cdrom/7.0-RELEASE

Note: The above make command has to be run from the top level of the mfsBSD directory tree, i.e. ~/mfsbsd-1.0-beta1/.

3.3 Booting mfsBSD

Now that the mfsBSD image is ready, it must be uploaded to the remote system running a live rescue system or pre-installed Linux® distribution. The most suitable tool for this task is scp:

# scp disk.img root@192.168.0.2:.

To boot mfsBSD image properly, it must be placed on the first (bootable) device of the given machine. This may be accomplished using this example providing that sda is the first bootable disk device:

# dd if=/root/disk.img of=/dev/sda bs=1m

If all went well, the image should now be in the MBR of the first device and the machine can be rebooted. Watch for the machine to boot up properly with the ping(8) tool. Once it has came back on-line, it should be possible to access it over ssh(1) as user root with the configured password.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.