4

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.

  • 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
12

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

1

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.

  • 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
0

There is a nice tool encled (available at https://github.com/amarao/sdled) to manage your enclosure led's.

You should be able to use it like this (not tested, though):

encled /dev/sgh fault

From the README:

fault - set led indicator to 'faulty'. This WILL NOT make device faulty, just set enclosure led to 'FAULTY' status.

  • 1
    Hi and welcome to the site. We like answers to be more comprehensive here. Could you edit your answer and provide an example of how the OP could use this tool to achieve their objective? As it stands, it is not an answer but a comment. – terdon Apr 2 '15 at 14:27
  • Look, if I have a tool and know where I can find this tool, whats wrong with answer? I definitely know that edited answer is wrong, since initially author of this question requested a locate led. But, anyway, this answer provide much easiest way to made led on enclosure blink than previous. – Siarhei Karatkevich Apr 3 '15 at 17:55
-1

lsscsi can give you this information.

lsscsi -g

will return the /dev/sgX address beside the /dev/sdX address.

  • Please expand on what information this command provides and how that answers the question.  Do not respond in comments; edit your answer to make it clearer and more complete. – G-Man Oct 9 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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