Page MenuHomeFreeBSD

D35336.id106430.diff
No OneTemporary

D35336.id106430.diff

Index: libexec/rc/rc.conf
===================================================================
--- libexec/rc/rc.conf
+++ libexec/rc/rc.conf
@@ -69,6 +69,8 @@
zfs_enable="NO" # Set to YES to automatically mount ZFS file systems
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.
# ZFSD support
zfsd_enable="NO" # Set to YES to automatically start the ZFS fault
Index: libexec/rc/rc.d/Makefile
===================================================================
--- libexec/rc/rc.d/Makefile
+++ libexec/rc/rc.d/Makefile
@@ -326,6 +326,7 @@
ZFS+= zfsd
ZFS+= zfskeys
ZFS+= zpool
+ZFS+= zpoolreguid
ZFS+= zvol
ZFSPACKAGE= rc
.endif
Index: libexec/rc/rc.d/zpoolreguid
===================================================================
--- /dev/null
+++ libexec/rc/rc.d/zpoolreguid
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# PROVIDE: zpoolreguid
+# REQUIRE: zpool
+# BEFORE: mountcritlocal
+# KEYWORD: firstboot nojail
+
+. /etc/rc.subr
+
+name="zpoolreguid"
+desc="Generate a new zpool GUID"
+rcvar="zfs_enable"
+start_cmd="zpoolreguid_start"
+
+zpoolreguid_start()
+{
+ local pool
+
+ for pool in "${zpool_reguid}"; do
+ zpool reguid $pool
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"
Index: share/man/man5/rc.conf.5
===================================================================
--- share/man/man5/rc.conf.5
+++ share/man/man5/rc.conf.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 3, 2022
+.Dd May 26, 2022
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -2067,6 +2067,12 @@
.Pa /etc/rc.d/zfs
will attempt to automatically mount ZFS file systems and initialize ZFS volumes
(ZVOLs).
+.It Va zpool_reguid
+.Pq Vt str
+A space-separated list of ZFS pool names for which new pool GUIDs should be
+assigned upon first boot.
+This is useful when using a ZFS pool copied from a template, such as a virtual
+machine image.
.It Va gptboot_enable
.Pq Vt bool
If set to

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 19, 6:47 PM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16726155
Default Alt Text
D35336.id106430.diff (2 KB)

Event Timeline