1*abcdc1b9SMartin Matuska.\" 2*abcdc1b9SMartin Matuska.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049). 3*abcdc1b9SMartin Matuska.\" Copyright (C) 2023 Lawrence Livermore National Security, LLC. 4*abcdc1b9SMartin Matuska.\" Refer to the OpenZFS git commit log for authoritative copyright attribution. 5*abcdc1b9SMartin Matuska.\" 6*abcdc1b9SMartin Matuska.\" The contents of this file are subject to the terms of the 7*abcdc1b9SMartin Matuska.\" Common Development and Distribution License Version 1.0 (CDDL-1.0). 8*abcdc1b9SMartin Matuska.\" You can obtain a copy of the license from the top-level file 9*abcdc1b9SMartin Matuska.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>. 10*abcdc1b9SMartin Matuska.\" You may not use this file except in compliance with the license. 11*abcdc1b9SMartin Matuska.\" 12*abcdc1b9SMartin Matuska.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049) 13*abcdc1b9SMartin Matuska.\" 14*abcdc1b9SMartin Matuska.Dd August 30, 2023 15*abcdc1b9SMartin Matuska.Dt ZFS_PREPARE_DISK 8 16*abcdc1b9SMartin Matuska.Os 17*abcdc1b9SMartin Matuska. 18*abcdc1b9SMartin Matuska.Sh NAME 19*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 20*abcdc1b9SMartin Matuska.Nd special script that gets run before bringing a disk into a pool 21*abcdc1b9SMartin Matuska.Sh DESCRIPTION 22*abcdc1b9SMartin Matuska.Nm 23*abcdc1b9SMartin Matuskais an optional script that gets called by libzfs before bringing a disk into a 24*abcdc1b9SMartin Matuskapool. 25*abcdc1b9SMartin MatuskaIt can be modified by the user to run whatever commands are necessary to prepare 26*abcdc1b9SMartin Matuskaa disk for inclusion into the pool. 27*abcdc1b9SMartin MatuskaFor example, users can add lines to 28*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 29*abcdc1b9SMartin Matuskato do things like update the drive's firmware or check the drive's health. 30*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 31*abcdc1b9SMartin Matuskais optional and can be removed if not needed. 32*abcdc1b9SMartin Matuskalibzfs will look for the script at @zfsexecdir@/zfs_prepare_disk. 33*abcdc1b9SMartin Matuska. 34*abcdc1b9SMartin Matuska.Ss Properties 35*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 36*abcdc1b9SMartin Matuskawill be passed the following environment variables: 37*abcdc1b9SMartin Matuska.sp 38*abcdc1b9SMartin Matuska.Bl -tag -compact -width "VDEV_ENC_SYSFS_PATH" 39*abcdc1b9SMartin Matuska. 40*abcdc1b9SMartin Matuska.It Nm POOL_NAME 41*abcdc1b9SMartin Matuska.No Name of the pool 42*abcdc1b9SMartin Matuska.It Nm VDEV_PATH 43*abcdc1b9SMartin Matuska.No Path to the disk (like /dev/sda) 44*abcdc1b9SMartin Matuska.It Nm VDEV_PREPARE 45*abcdc1b9SMartin Matuska.No Reason why the disk is being prepared for inclusion 46*abcdc1b9SMartin Matuska('create', 'add', 'replace', or 'autoreplace'). 47*abcdc1b9SMartin MatuskaThis can be useful if you only want the script to be run under certain actions. 48*abcdc1b9SMartin Matuska.It Nm VDEV_UPATH 49*abcdc1b9SMartin Matuska.No Path to one of the underlying devices for the 50*abcdc1b9SMartin Matuskadisk. 51*abcdc1b9SMartin MatuskaFor multipath this would return one of the /dev/sd* paths to the disk. 52*abcdc1b9SMartin MatuskaIf the device is not a device mapper device, then 53*abcdc1b9SMartin Matuska.Nm VDEV_UPATH 54*abcdc1b9SMartin Matuskajust returns the same value as 55*abcdc1b9SMartin Matuska.Nm VDEV_PATH 56*abcdc1b9SMartin Matuska.It Nm VDEV_ENC_SYSFS_PATH 57*abcdc1b9SMartin Matuska.No Path to the disk's enclosure sysfs path, if available 58*abcdc1b9SMartin Matuska.El 59*abcdc1b9SMartin Matuska.Pp 60*abcdc1b9SMartin MatuskaNote that some of these variables may have a blank value. 61*abcdc1b9SMartin Matuska.Nm POOL_NAME 62*abcdc1b9SMartin Matuskais blank at pool creation time, for example. 63*abcdc1b9SMartin Matuska.Sh ENVIRONMENT 64*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 65*abcdc1b9SMartin Matuskaruns with a limited $PATH. 66*abcdc1b9SMartin Matuska.Sh EXIT STATUS 67*abcdc1b9SMartin Matuska.Nm zfs_prepare_disk 68*abcdc1b9SMartin Matuskashould return 0 on success, non-zero otherwise. 69*abcdc1b9SMartin MatuskaIf non-zero is returned, the disk will not be included in the pool. 70*abcdc1b9SMartin Matuska. 71