Created
December 15, 2023 03:10
-
-
Save bindi/bf0a9a2141366b3cfe203c66f5bb87b4 to your computer and use it in GitHub Desktop.
Blinks the locate led if your disk shelf and HBA supports it. Tested on a NetApp DS4243 (IOM6 module) + LSI SAS 9200-8E.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE | |
# blink_led <device> that exists as /dev/disk/by-id/<device> | |
# you should use by-id mounts in zfs (instead of /dev/sda etc) | |
# so copying that directly when at a faulted state (for example) | |
# should be enough. if you use by-vdev, edit the script to suit | |
# your needs. | |
BLOCKDEVICE=$(basename $(readlink -f /dev/disk/by-id/$1)) | |
BLINKDEVICE=/sys/class/enclosure/*/*/device/block/$BLOCKDEVICE/../../enclosure*/locate | |
LEDSTATUS=$(cat $BLINKDEVICE) | |
((LEDSTATUS = !LEDSTATUS)) | |
echo "Echoing $LEDSTATUS to $BLINKDEVICE ..." | |
echo $LEDSTATUS > $BLINKDEVICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment