Page MenuHomeFreeBSD

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

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

Details

Summary

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:

12.0-RELEASE-p10_2019-10-03_185233

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

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
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
usr.sbin/freebsd-update/freebsd-update.sh
847

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.