FreeBSD has spent the last few years implementing awesome Solaris-based features such as DTrace and ZFS. Here at Wayfair, we use FreeBSD on our servers and our development environments. As a security engineer for Wayfair, I’m tasked with many fun projects. I get to test out different configurations and applications in FreeBSD. Naturally, I set up a FreeBSD 8-STABLE VM to do my testing.

ZFS gives you a lot of flexibility and stability. I decided to go with ZFS on my VM so that I could emulate OpenIndiana’s boot environment (BE) system. For an example on how boot environments work, please refer to the OpenSolaris documentation.

Using boot environments, you can have completely different installations of FreeBSD side-by-side. In one BE, you may run 8-STABLE and in another BE, you may run 9-CURRENT.

Installing ZFS on root in FreeBSD is still a manual task. I modified the documentation for setting up ZFS on root. Instead of creating different ZFS datasets for /usr, /usr/home, /var, /var/db, etc., I created a single dataset for the root filesystem. On my personal server at home, I’m running OpenIndiana. Here’s what the dataset layout looks like:

shawn@indianapolis:~$ zfs list -r rpool
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     10.6G   218G    46K  /rpool
rpool/ROOT                6.06G   218G    31K  legacy
rpool/ROOT/openindiana    9.22M   218G  3.03G  /
rpool/ROOT/openindiana-1  13.9M   218G  3.89G  /
rpool/ROOT/openindiana-2  6.04G   218G  4.05G  /

So, naturally, my root pool in FreeBSD is going to look similar:

[root@fbsd-sec ~]# zfs mount
rpool/ROOT/base                 /
rpool                           /rpool
rpool/ROOT                      /rpool/ROOT
rpool/home                      /usr/home
rpool/home/shawn                /usr/home/shawn

Another FreeBSD user has graciously provided a script that mirrors the behavior of Solaris’ `beadm` utility. Using this script, we can now create and manage new BEs. First, create a BE by running `manageBE -n <newBEName> -s <oldBEName> -p rpool`. Then when you’re ready to reboot into the BE, run `manageBE -n <newBEName> -p rpool` and reboot.

As you can see, ZFS is a very powerful filesystem. When combined with an awesome enterprise OS like FreeBSD, you get a very powerful and capable server.