Page MenuHomeFreeBSD

rc(8): Add a zpoolupgrade rc.d script
ClosedPublic

Authored by lwhsu on Nov 5 2022, 5:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 10:13 AM
Unknown Object (File)
Sun, Apr 21, 9:48 PM
Unknown Object (File)
Sun, Apr 21, 9:48 PM
Unknown Object (File)
Sat, Apr 20, 7:10 AM
Unknown Object (File)
Sat, Apr 20, 6:58 AM
Unknown Object (File)
Feb 16 2024, 2:56 PM
Unknown Object (File)
Feb 16 2024, 11:20 AM
Unknown Object (File)
Feb 16 2024, 11:20 AM
Subscribers

Details

Summary

If a zpool is created by makefs(8), its version is 5000, i.e., all
feature flags are off. Introduce an rc script to run zpool upgrade
over the assigned zpools on the first boot. This is useful to the
ZFS based VM imagess built from release(7).

Sponsored by: The FreeBSD Foundation

Diff Detail

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

Event Timeline

lwhsu requested review of this revision.Nov 5 2022, 5:31 PM

So long as this is off by default, and only on first boot when on, then it's safe.
It becomes very dangerous if there's an upgrade of the zpool when no upgrade of the boot loader has happened.

This revision is now accepted and ready to land.Nov 5 2022, 9:25 PM
mav added a subscriber: mav.

On TrueNAS we do not upgrade pools automatically to allow users to make sure system operates properly to keep possibility of downgrade if anything go wrong. But if this works only on first boot after install it should probably be fine.

Thanks!

In D37282#846915, @imp wrote:

So long as this is off by default, and only on first boot when on, then it's safe.
It becomes very dangerous if there's an upgrade of the zpool when no upgrade of the boot loader has happened.

Just a note: this is a good example of something that should have a functional test, so that we can detect breakage upon a new OpenZFS import for instance, but it doesn't really fit into our regression test suite. We would ideally have a test which boots up a makefs-created VM image, upgrades the pool, then reboots the VM and verifies that 1) the loader was able to boot from the pool and 2) the upgrade "took". It should be tested with legacy BIOS loader/userboot/EFI loader. We don't yet have any framework for writing a test like this. There's other tests that would have a similar shape, for instance regression tests for kernel dumps.

share/man/man5/rc.conf.5
2116

Yes this is aimed for being used in VM and cloud images for the fist boot or on provisioning. The intention is the same as zpoolreguid rc script, to provide a way to users to use all ZFS features in these environment.

This revision was automatically updated to reflect the committed changes.