Page MenuHomeFreeBSD

loader: Add support for booting from a ZFS snapshot
ClosedPublic

Authored by allanjude on Feb 15 2023, 1:59 AM.
Tags
None
Referenced Files
F83415878: D38600.id117273.diff
Fri, May 10, 5:51 AM
F83399178: D38600.id.diff
Thu, May 9, 11:37 PM
F83399174: D38600.id117273.diff
Thu, May 9, 11:37 PM
F83398538: D38600.diff
Thu, May 9, 11:22 PM
Unknown Object (File)
Tue, May 7, 3:08 AM
Unknown Object (File)
Wed, Apr 17, 4:44 PM
Unknown Object (File)
Apr 6 2024, 3:15 PM
Unknown Object (File)
Mar 9 2024, 8:05 PM

Details

Summary

When booting from a snapshot we need to follow a different code path
to turn the objset ID into the name, and for forward lookups we need
to walk the parent's snapnames_zap.

With this, it is possible to set the pools BOOTFS property to a
snapshot and boot with a read-only filesystem of that snapshot.

Sponsored By: Beckhoff Automation GmbH & Co. KG
Sponsored By: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 15 2023, 2:00 AM
Harbormaster failed remote builds in B49792: Diff 117273!

so can we use zfs:<snapshot> in all the places where we can use zfs:<dataset> now with these changes?

btw, this looks really cool...

One other thing... where is the 'read only' flag set. I may be missing it, but I don't see it here.

In D38600#881029, @imp wrote:

so can we use zfs:<snapshot> in all the places where we can use zfs:<dataset> now with these changes?

yes, you can use a snapshot for currdev etc.

You can use it with zpool set bootfs=<snapshot> pool

In D38600#881030, @imp wrote:

btw, this looks really cool...

One other thing... where is the 'read only' flag set. I may be missing it, but I don't see it here.

Like a CDROM, the snapshot is just always read-only, it didn't require setting any other flags. Every filesystem is read-only until we remount root r/w later in the boot process.

This revision is now accepted and ready to land.Feb 21 2023, 10:39 PM

Tested - works as expected for me,