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

Cleaning Up from the Build Process

Now, you should have a new boot environment running in a jail and updated, all that's left is to clean everything up. Start by stopping the jail.

jail -f /jails/devel/jail.conf -r freebsd-zfs-devel

Next, you need to put the temporary build environment back in place, to run that last delete old files step. Then we are going to delete the data under /jails/devel/ROOT/usr/obj, as these are temp build files. This isn't strictly necessary, but why waste disk space.

cd /jails/devel
cat /jails/devel/setbuild.env
(copy and paste the output)
cd /jails/devel/ROOT/usr/src
make -DBATCH_DELETE_OLD_FILES delete-old-libs
rm -r jails/ lib32/
cd /jails/devel
cat /jails/devel/unsetbuild.env
(copy and paste the output)

Note:  Of course if you didn't create the setbuild.env and unsetbuild.env files previously, go back to those steps to get the commands that were contained in them.

Use the beadm command to dismount the boot environment from its jail file system.

# beadm umount 10.1-RELEASE-p3-r276159-2015.01.09
Unmounted successfully