Page MenuHomeFreeBSD

freebsd-update: create a ZFS boot environment on install if the system supports it
ClosedPublic

Authored by dave_fullard.ca on Oct 3 2019, 10:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 5:01 PM
Unknown Object (File)
Thu, Apr 11, 1:45 PM
Unknown Object (File)
Sun, Mar 31, 2:00 PM
Unknown Object (File)
Mar 12 2024, 7:31 AM
Unknown Object (File)
Mar 12 2024, 7:31 AM
Unknown Object (File)
Mar 10 2024, 8:24 PM
Unknown Object (File)
Mar 8 2024, 5:31 AM
Unknown Object (File)
Mar 8 2024, 5:18 AM
Subscribers

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

usr.sbin/freebsd-update/freebsd-update.sh
888

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.

dave_fullard.ca retitled this revision from Create a ZFS boot environment if the system supports it to freebsd-update: create a ZFS boot environment on install if the system supports it.Nov 15 2019, 12:00 AM

ping: Is there anything left for Dave to do here, or can we commit this?

usr.sbin/freebsd-update/freebsd-update.sh
888

I think we can just drop this entire case and commit it otherwise as-is, at this rate. bectl check made it into 12.1, and unfortunately this stalled out for too long for 11.4 to matter (though it has check as well), I think. If one gets to a point that they have *this* version of freebsd-update that knows about bectl, they should already have a bectl check installed.

ping: Is there anything left for Dave to do here, or can we commit this?

I'm going to go ahead and remove the referenced case and commit this tonightish.

ping: Is there anything left for Dave to do here, or can we commit this?

I'm going to go ahead and remove the referenced case and commit this tonightish.

Is it tonightish yet?

This revision was not accepted when it landed; it landed in state Needs Review.Jul 16 2021, 4:08 AM
This revision was automatically updated to reflect the committed changes.