Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to blink the failing device in my 24-disk SAS enclosure.

I have found sg_ses --index 7 --set=locate /dev/sg24 which is supposed to identify slot 7.

But how do I figure out which slot/index /dev/sdh is?

This is not obvious as Linux does not name /dev/sdX after the slot, but after the sequence it was detected. Think what happens if slot 1 is empty at boot, but is filled later.

Edit:

The controller is a SAS2008.

share|improve this question
1  
This is completely dependent upon your array controller hardware. You need to tell us what that is. –  Patrick Apr 19 '12 at 23:12
    
I checked my system (Sles11 sp2), the sg_ses doesn't have a --index and --set as input params, and there is no /sys/class/enclosure* in the sles11 sp2. What's your Linux environment? Did you install other utilities in the OS by yourself? –  user22001 Aug 13 '12 at 8:46
    
Debian Stable: Linux server 3.2.0-0.bpo.1-amd64 –  Ole Tange Aug 13 '12 at 13:15
add comment

2 Answers

up vote 5 down vote accepted

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://github.com/ole-tange/tangetools/tree/master/blink

share|improve this answer
add comment

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.

share|improve this answer
    
Thanks for pointing me to /sys. As you can see the solution is a bit more involved. –  Ole Tange Apr 20 '12 at 9:35
    
@OleTange Ok. You should post your solution as an answer, please don't post answers in questions as they are not easily visible to future visitors. It's OK to ask and answer your own question.. I'll leave my answer because it shows the general approach, but you should accept your own answer (when the system lets you, there's a delay) since it's more complete for this particular task on this particular enclosure. –  Gilles Apr 20 '12 at 12:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.