Page MenuHomeFreeBSD

Create a ZFS boot environment if the system supports it
Needs ReviewPublic

Authored by on Thu, Oct 3, 10:52 PM.



Updated freebsd-update to allow it to create boot environments using bectl
should the system support it. The bectl utility was updated in r352211 to
support a 'check' to determine if the system supports boot environments.
If the check fails, it will fall back to a manual method to discover if the
system is running ZFS and that root is mounted. If UFS is used, the bectl
check will fail then no attempt will be made to create the boot environment.
If freebsd-update is run inside a jail, no attempt will be made to create a
boot environment.

The boot environment function will create a new environment using the format:
current FreeBSD kernel version and date/timestamp, example:


This functionality can be disabled by setting 'CreateBootEnv' in
freebsd-update.conf to 'no'.

Diff Detail

rS FreeBSD src repository
Lint OK
No Unit Test Coverage
Build Status
Buildable 26855
Build 25179: arc lint + arc unit

Event Timeline

allanjude added inline comments.Thu, Oct 3, 11:05 PM

kldstat -q -m zfs will return 0 if ZFS is loaded, and 1 otherwise, without printing anything

Your current code has the slightly beneficial side-effect of also matching openzfs.ko for those using the sysutils/openzfs port, but I imagine that was unintentional.