Beadm

Beatm is used to manage boot environments. That can help you to rollback an upgrade in case it makes problems.

To install it:

/usr/ports/sysutils/beadm
make install
make clean

Convert existing ZFS structure to beadm required structure

We have an already existing standard ZFS folder structure. To get this working with boot environments we have to modify it a little bit.

At first we install beadm:

portsnap fetch
portsnap extract
cd /usr/ports/sysutils/beadm
make install clean

Now we clone our existing system and convert it to beadm aware structure:

zfs create -o mountpoint=none zroot/ROOT 
zfs snapshot zroot@be 
zfs clone zroot@be zroot/ROOT/default
zpool set bootfs=zroot/ROOT/default zroot
reboot (before executing this, make sure you are on FreeBSD 9.2 and to pool to boot is not defined in /boot/loader.conf)

Now we can run the beadm tool.

To finish it now, we remove the old structure:

zfs promote zroot/ROOT/default
mkdir /mnt/test
zfs set mountpoint=/mnt/test zroot
cd /mnt/test
chflags -R noschg *
rm -R *
rm -R .*
cd ..
zfs set mountpoint=none zroot

Upgrade system with beadm support

beadm list 
beadm activate default 
reboot