How To Use beadm to Upgrade FreeBSD installed in a ZFS Boot Environment, with minimal downtime

Getting Started

The first thing that you need is a FreeBSD system installed in a ZFS environment. You will also need to make sure that any data partitions are installed on datasets not included in the boot environment. The following is a very simple setup showing ZFS datasets that I will be using on the test system I am building as I write this documentation. The key here is the zroot/ROOT is a container that is used to hold the boot environments, make sure its canmount property is set to noauto. The following example has a few new data set created but otherwise is based on the previous help file I wrote on installing FreeBSD on ZFS. The initial boot environment is simply called "install". Since this test system doesn't have anything else installed its layouts pretty simple. The temp file systems are of course kept out of the boot environment, I have created separate dataset for /usr/src, /usr/ports, /usr/ports/distfiles, /var/log, and /home. These will be retained through updates and prevent any data from unnecessarily being replicated. The dataset zroot/jails and subset devel will be explained later, as I have created them as part of this process.

NAME                        USED  AVAIL  REFER  MOUNTPOINT
zroot                      1.92G  13.5G    19K  none
zroot/ROOT                  875M  13.5G    19K  none
zroot/ROOT/install          875M  13.5G   875M  legacy
zroot/home                 75.5K  13.5G  75.5K  /home
zroot/jails                  38K  13.5G    19K  /jails
zroot/jails/devel            19K  13.5G    19K  /jails/devel
zroot/tmp                    19K  13.5G    19K  /tmp
zroot/usr-ports             353M  13.5G   353M  /usr/ports
zroot/usr-ports-distfiles    19K  13.5G    19K  /usr/ports/distfiles
zroot/usr-src               735M  13.5G   735M  /usr/src
zroot/var-log              60.5K  13.5G  60.5K  /var/log
zroot/var-tmp                19K  13.5G    19K  /var/tmp

Note:  In addition to creating the additional ZFS Datasets, I have checked out the source tree from https://svn0.us-west.freebsd.org/base/releng/10.1, and the ports tree from https://svn0.us-west.freebsd.org/ports/head.