I had some passing familiarity with ZFS in Linux and it seemed interesting. On FreeBSD, ZFS is more core to the platform. There is lot to it but the concepts aren’t difficult.
One of the core elements of ZFS are datasets. A dataset is sort of like a partition but more flexible. You can use them for snapshots and other things. A list of the datasets in a system is produced with zfs list
:
NAME USED AVAIL REFER MOUNTPOINT
zroot 3.41G 256G 96K /zroot
zroot/ROOT 2.57G 256G 96K none
zroot/ROOT/14.1 2.57G 256G 2.57G /
zroot/ROOT/default 240K 256G 2.57G /
zroot/home 244K 256G 96K /home
zroot/home/rob 148K 256G 148K /home/rob
zroot/tmp 120K 256G 120K /tmp
zroot/usr 852M 256G 96K /usr
zroot/usr/ports 96K 256G 96K /usr/ports
zroot/usr/src 852M 256G 852M /usr/src
zroot/var 648K 256G 96K /var
zroot/var/audit 96K 256G 96K /var/audit
zroot/var/crash 96K 256G 96K /var/crash
zroot/var/log 168K 256G 168K /var/log
zroot/var/mail 96K 256G 96K /var/mail
zroot/var/tmp 96K 256G 96K /var/tmp
The most interesting part of the listing above is the zroot/ROOT
and it’s children zroot/ROOT/14.1
and zroot/ROOT/default
. Those children are boot environments. These boot environments allow you save a current known good system and apply patches and upgrades. If something goes awry, you can select the known good boot environment and figure out what happened. Very cool.
To do this on FreeBSD, you install a boot environment manager. beadm seems like the standard utility to do this. It’s easily installed using pkg install beadm
and once there, you can work with boot environments.
beadm list
shows the current boot environments:
root@dell620:~ # beadm list
BE Active Mountpoint Space Created
default - - 756.0K 2024-10-29 20:50
14.1 NR / 2.6G 2024-11-02 09:49
I created the 14.1 boot environment using beadm create 14.1
and made it active with beadm activate 14.1
. After a reboot, that boot environment was mounted and used to boot the system.
Boot environments are easy to create and could really save time when things don’t go well during an upgrade.