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)
Fri, Nov 29, 2:03 AM
Unknown Object (File)
Wed, Nov 27, 6:39 PM
Unknown Object (File)
Sun, Nov 17, 7:03 AM
Unknown Object (File)
Fri, Nov 8, 9:36 AM
Unknown Object (File)
Oct 21 2024, 2:06 PM
Unknown Object (File)
Oct 20 2024, 4:42 PM
Unknown Object (File)
Oct 20 2024, 4:42 PM
Unknown Object (File)
Oct 20 2024, 4:42 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,