mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
78fd79eacd
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 <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #15243
71 lines
2.4 KiB
Groff
71 lines
2.4 KiB
Groff
.\"
|
|
.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
|
|
.\" Copyright (C) 2023 Lawrence Livermore National Security, LLC.
|
|
.\" Refer to the OpenZFS git commit log for authoritative copyright attribution.
|
|
.\"
|
|
.\" The contents of this file are subject to the terms of the
|
|
.\" Common Development and Distribution License Version 1.0 (CDDL-1.0).
|
|
.\" You can obtain a copy of the license from the top-level file
|
|
.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
|
|
.\" You may not use this file except in compliance with the license.
|
|
.\"
|
|
.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049)
|
|
.\"
|
|
.Dd August 30, 2023
|
|
.Dt ZFS_PREPARE_DISK 8
|
|
.Os
|
|
.
|
|
.Sh NAME
|
|
.Nm zfs_prepare_disk
|
|
.Nd special script that gets run before bringing a disk into a pool
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
is an optional script that gets called by libzfs before bringing a disk into a
|
|
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
|
|
.Nm zfs_prepare_disk
|
|
to do things like update the drive's firmware or check the drive's health.
|
|
.Nm zfs_prepare_disk
|
|
is optional and can be removed if not needed.
|
|
libzfs will look for the script at @zfsexecdir@/zfs_prepare_disk.
|
|
.
|
|
.Ss Properties
|
|
.Nm zfs_prepare_disk
|
|
will be passed the following environment variables:
|
|
.sp
|
|
.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH"
|
|
.
|
|
.It Nm POOL_NAME
|
|
.No Name of the pool
|
|
.It Nm VDEV_PATH
|
|
.No Path to the disk (like /dev/sda)
|
|
.It Nm VDEV_PREPARE
|
|
.No Reason why the disk is being prepared for inclusion
|
|
('create', 'add', 'replace', or 'autoreplace').
|
|
This can be useful if you only want the script to be run under certain actions.
|
|
.It Nm VDEV_UPATH
|
|
.No Path to one of the underlying devices for the
|
|
disk.
|
|
For multipath this would return one of the /dev/sd* paths to the disk.
|
|
If the device is not a device mapper device, then
|
|
.Nm VDEV_UPATH
|
|
just returns the same value as
|
|
.Nm VDEV_PATH
|
|
.It Nm VDEV_ENC_SYSFS_PATH
|
|
.No Path to the disk's enclosure sysfs path, if available
|
|
.El
|
|
.Pp
|
|
Note that some of these variables may have a blank value.
|
|
.Nm POOL_NAME
|
|
is blank at pool creation time, for example.
|
|
.Sh ENVIRONMENT
|
|
.Nm zfs_prepare_disk
|
|
runs with a limited $PATH.
|
|
.Sh EXIT STATUS
|
|
.Nm zfs_prepare_disk
|
|
should return 0 on success, non-zero otherwise.
|
|
If non-zero is returned, the disk will not be included in the pool.
|
|
.
|