ZFS_PREPARE_DISK(8)
π zfs_prepare_disk(8) π
okay bestie, gather round, because this one is a script, and it's the glow-up station your disks visit before they get to join the pool. it lives in section 8 of the System Manager's Manual, and honestly? she's optional but she's iconic. π
β¨ NAME β¨
zfs_prepare_disk β the special little script that gets run before bringing a disk into a pool. like, the pre-game ritual. the outfit check. the vibe check before the disk walks into the party. π¦
πΈ DESCRIPTION πΈ
so here's the tea: zfs_prepare_disk is an optional script that gets called by libzfs before bringing a disk into a pool. it's yours to modify, bestie β you can make it run literally whatever commands are necessary to get a disk ready for inclusion into the pool. no cap. π
wanna update the drive's firmware? wanna check the drive's health? just add lines to zfs_prepare_disk and it's handled. it's giving personal assistant energy. π
and because she's optional, she can absolutely be removed if you don't need her β no hard feelings, no drama. libzfs will look for the script at:
/usr/lib/zfs-linux/zfs_prepare_disk
that's her address. that's where she hangs out. π
π§ Properties π§
zfs_prepare_disk gets passed the following environment variables β think of them as the little notes she gets handed on her way in:
POOL_NAMEβ Name of the pool. πVDEV_PATHβ Path to the disk (like/dev/sda).VDEV_PREPAREβ 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.VDEV_UPATHβ 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, thenVDEV_UPATHjust returns the same value asVDEV_PATH.VDEV_ENC_SYSFS_PATHβ Path to the disk's enclosure sysfs path, if available.
not me needing to say this but: some of these variables may have a blank value. POOL_NAME is blank at pool creation time, for example. so like, don't be shocked when it ghosts you. π
π ENVIRONMENT π
zfs_prepare_disk runs with a limited $PATH. that's it, that's the whole vibe. plan accordingly, bestie. β¨
β EXIT STATUS β
zfs_prepare_disk should return 0 on success, non-zero otherwise.
and if non-zero is returned, the disk will not be included in the pool. no invite, no party, no pool. fr fr. π
and that's the whole page, bestie π«Ά β this gem came from OpenZFS, dated August 30, 2023, and it's your System Manager's Manual serving it up in section 8. slay, go prepare some disks, and remember: return 0 or the disk stays outside. periodt. πβ¨πΈ
π¦ where this page comes from
- debian trixie: zfsutils-linux 2.3.9-0+deb13u1 Β· CDDL-1.0
- ubuntu questing: zfsutils-linux 2.3.4-1ubuntu2
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5 Β· CDDL-1.0
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5.1 Β· CDDL-1.0
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: CDDL-1.0
- Copyright (C) 2023 Lawrence Livermore National Security, LLC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms