FreeBSD:ZFS Install

From Wiki³
Revision as of 20:26, 23 January 2012 by Kyau (talk | contribs)

The following is how to install FreeBSD on ZFS root using GPT. This will offer redundancy and scaling of performance (with additional drives) for you to base your system off of while maintaining efficiency of disk usage. This guide is mainly suited for workstations, home file servers, and media center PCs. It is setup for use with FreeBSD 9+ and was directly tested with 9.0-RELEASE version of FreeBSD which includes the new BSDInstall[1].

Introduction to FreeBSD

I am going to make the assumption that you have at least a basic knowledge of the command line in FreeBSD. If you are new to FreeBSD all hope is not lost. The FreeBSD Handbook is the primary source of documentation produced by the FreeBSD Documentation Project. Aside from this recently there has also been another great article written by Paul Venezia at InfoWorld entitled Why aren't you using FreeBSD?. If you are familiar with linux but new to FreeBSD there is the FreeBSD Quickstart Guide for Linux Users. Last but not least if you are coming over from Windows you can take a look at FreeBSD is NOT Windows.

ZFS became part of FreeBSD on 6th April 2007, while it stayed in the experimental phase until the 15th of September 2009[2] when they removed the experimental tag and deemed it ready for production use. Then on the 23th of November 2009[3] zfsloader was merged into -STABLE making ZFS as boot option easier than ever.

geli is an easy to use block device encryption to encrypt disks on a lower level than the filesystem. We will be taking advantage of geli for our swap and temporary directories.

ZFS, geli and other newer features that have been recently added into FreeBSD are not available through the generic sysinstall(8) that is included on all of the default installation media. To remedy this, I am going to show you how to install FreeBSD manually from the Fixit livefs command line.

Obtaining FreeBSD

The first thing you are going to need is a copy of the most current *-dvd1.iso or *-memstick.img FreeBSD image (the other images do not contain the livefs that is needed). FreeBSD may be obtained from torrent, an FTP mirror near you, or from FreeBSD Daily Snapshots.

Booting the Installation Media

At this point you should boot from your installation media. For use in creation of this tutorial the following test image was used inside of VirtualBox. Template:Pre

When you first boot up your chosen media you will see the normal boot menu, feel free to wait out the allotted time or press enter. After the system is done booting up you will be presented with the 'Welcome' window inside the new BSDInstaller.

Setting Up Our Working Environment

Select < Shell > from the options and press enter. You should now be presented with the shell. First thing we need to do is switch /tmp from read-only to writable (used later to store the zpool.cache file) and then load the required kernel modules via kldload(8).

umount /dev/md1

Ignore any errors you may or may not see from executing this command, the /tmp directory will still be unmounted. Remount the tmp directory and load the needed kernel modules.

mdmfs -s 512M md1 /tmp

kldload geom_mirror

kldload opensolaris

kldload zfs

Notes