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)
Sat, Apr 6, 3:15 PM
Unknown Object (File)
Mar 9 2024, 8:05 PM
Unknown Object (File)
Mar 9 2024, 8:04 PM
Unknown Object (File)
Mar 6 2024, 3:51 AM
Unknown Object (File)
Feb 19 2024, 5:04 PM
Unknown Object (File)
Jan 1 2024, 12:08 PM
Unknown Object (File)
Dec 20 2023, 8:26 AM
Unknown Object (File)
Dec 3 2023, 11:41 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 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,