Locate disk in SAS enclosure

After cycling around /sys for a while, I found this solution:

# echo /sys/class/enclosure/*/*/device/block/sdaa
/sys/class/enclosure/2:0:35:0/Slot 15/device/block/sdaa
# echo 1 > '/sys/class/enclosure/2:0:35:0/Slot 15/locate' 

Or:

# echo 1 > /sys/class/enclosure/*/*/device/block/sdaa/../../enclosure*/locate

To blink all detected devices:

parallel echo 1 \> ::: /sys/class/enclosure/*/*/device/block/sd*/../../enclosure*/locate

This is useful if you have a drive that is so broken that is not even detected by Linux (e.g. it does not spin up).

Edit:

I have made a small tool (called blink) to blink slots. https://gitlab.com/ole.tange/tangetools/tree/master/blink


Check what /sys/class/block/sdh links to. You can see the host, target and LUN this way. Usually this is enough to pinpoint the device's hardware address.