aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2023-09-21 08:36:26 -0700
committerTony Hutter <[email protected]>2023-11-06 16:45:07 -0800
commit78fd79eacdc98f5452f69d62b55ba3f6c4d8018c (patch)
tree0d1137fcd507d301071c2e5334ec9a835e375344 /scripts
parent6d693e20a20d7abd88dbae1f1075b2aca8c2faa2 (diff)
Add zfs_prepare_disk script for disk firmware install
Have libzfs call a special `zfs_prepare_disk` script before a disk is included into the pool. The user can edit this script to add things like a disk firmware update or a disk health check. Use of the script is totally optional. See the zfs_prepare_disk manpage for full details. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #15243
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am2
-rwxr-xr-xscripts/zfs_prepare_disk17
2 files changed, 19 insertions, 0 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 95640727a..b43bf97db 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -20,6 +20,8 @@ scripts_scripts = \
if CONFIG_USER
dist_scripts_SCRIPTS = $(scripts_scripts)
+dist_zfsexec_SCRIPTS = \
+ %D%/zfs_prepare_disk
else
dist_noinst_SCRIPTS += $(scripts_scripts)
endif
diff --git a/scripts/zfs_prepare_disk b/scripts/zfs_prepare_disk
new file mode 100755
index 000000000..02aa9f8a7
--- /dev/null
+++ b/scripts/zfs_prepare_disk
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# This is an optional helper script that is automatically called by libzfs
+# before a disk is about to be added into the pool. It can be modified by
+# the user to run whatever commands are necessary to prepare a disk for
+# inclusion into the pool. For example, users can add lines to this
+# script to do things like update the drive's firmware or check the drive's
+# health. The script is optional and can be removed if it is not needed.
+#
+# See the zfs_prepare_disk(8) man page for details.
+#
+# Example:
+#
+# echo "Prepare disk $VDEV_PATH ($VDEV_UPATH) for $VDEV_PREPARE in $POOL_NAME"
+#
+
+exit 0