diff options
author | Li-Wen Hsu <lwhsu@FreeBSD.org> | 2022-11-07 06:30:09 +0300 |
---|---|---|
committer | Li-Wen Hsu <lwhsu@FreeBSD.org> | 2022-11-07 06:30:09 +0300 |
commit | 72a1cb05cd230ce0d12a7180ae65ddbba2e0cb6d (patch) | |
tree | 2587ae4ca0c5601f1102ffa894233a63dce490a7 /libexec | |
parent | f83db6441a2f4f925a169c7ddf844589cb73c9b5 (diff) |
rc(8): Add a zpoolupgrade rc.d script
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 images built from release(7).
Reviewed by: imp, markj, mav
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37282
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rc/rc.conf | 2 | ||||
-rw-r--r-- | libexec/rc/rc.d/Makefile | 1 | ||||
-rwxr-xr-x | libexec/rc/rc.d/zpoolupgrade | 25 |
3 files changed, 28 insertions, 0 deletions
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index bc908075d033..a71a3fa4063d 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -77,6 +77,8 @@ zfskeys_enable="NO" # Set YES to autoload ZFS encryption keys zfs_bootonce_activate="NO" # Set YES to make successful bootonce BE permanent zpool_reguid="" # Set to zpools for which the GUID should be replaced # upon first boot. +zpool_upgrade="" # Set to zpools for which the version should be upgraded + # upon first boot. # ZFSD support zfsd_enable="NO" # Set to YES to automatically start the ZFS fault diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index e8ee61ffdff8..0f0d87bdde80 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -328,6 +328,7 @@ ZFS+= zfsd ZFS+= zfskeys ZFS+= zpool ZFS+= zpoolreguid +ZFS+= zpoolupgrade ZFS+= zvol ZFSPACKAGE= rc .endif diff --git a/libexec/rc/rc.d/zpoolupgrade b/libexec/rc/rc.d/zpoolupgrade new file mode 100755 index 000000000000..6f5720bac6a7 --- /dev/null +++ b/libexec/rc/rc.d/zpoolupgrade @@ -0,0 +1,25 @@ +#!/bin/sh + +# PROVIDE: zpoolupgrade +# REQUIRE: zpool +# BEFORE: mountcritlocal +# KEYWORD: firstboot nojail + +. /etc/rc.subr + +name="zpoolupgrade" +desc="Upgrade zpool version" +rcvar="zfs_enable" +start_cmd="zpoolupgrade_start" + +zpoolupgrade_start() +{ + local pool + + for pool in ${zpool_upgrade}; do + zpool upgrade $pool + done +} + +load_rc_config $name +run_rc_command "$1" |