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
Unknown Object (File)
Thu, Jul 25, 12:14 AM
Unknown Object (File)
Wed, Jul 24, 10:54 AM
Unknown Object (File)
Mon, Jul 15, 9:34 AM
Unknown Object (File)
Mon, Jul 15, 12:25 AM
Unknown Object (File)
Sat, Jul 13, 8:54 PM
Unknown Object (File)
Thu, Jul 11, 6:56 PM
Unknown Object (File)
Thu, Jun 27, 4:30 PM
Unknown Object (File)
Jun 27 2024, 12:16 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 Passed
Unit
No Test Coverage
Build Status
Buildable 49934
Build 46826: arc lint + arc unit

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,