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)
Wed, May 22, 1:19 PM
Unknown Object (File)
Sun, May 12, 10:13 PM
Unknown Object (File)
Sun, May 12, 10:13 PM
Unknown Object (File)
Fri, May 10, 5:51 AM
Unknown Object (File)
Thu, May 9, 11:37 PM
Unknown Object (File)
Thu, May 9, 11:37 PM
Unknown Object (File)
Thu, May 9, 11:22 PM
Unknown Object (File)
Tue, May 7, 3:08 AM

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,