views:

51

answers:

1

Hey all,

Just like in the main question, is there a way to do this? (Other than inducing a high io load) Maybe some facility deep down in the kernel that controls this?

I'm looking to write a little script to identify failed drives in my software raid array. (Blinking the activity light in a certain repeating pattern, etc.)

I read about all the good ideas here: http://serverfault.com/questions/64239/physically-identify-the-failed-hard-drive unfortunately I didn't tag any of my drives and they're all sandwiched together so looking at serial numbers is out.

A: 

Activity lights are generally hard-wired to the motherboard's disk controller. There is no OS facility for directly controlling them.

However, if you know which drive is problematic in software, and it is not mounted (just to be safe), you could probably dd either to or from it (I expect not the entire drive is bad?) to blink the light. For example:

#!/bin/bash

badDrive=$1
while true ; do
    dd -if "$badDrive" -of "/dev/null" -bs 512 -count 204800 conv=noerror >/dev/null 2>&1
    sleep 2
done

This will read 100MiB from the drive ignoring read errors, sleep two seconds, and then do it again. Pass in the hard disk device path, like /dev/sda.

You'll need to figure out a way to kill the script before inserting a new drive, though. Otherwise you'll have really bad performance and it may cause other problems.

Jonathan
As I above, the purpose of this was to identify failed drives in a hot swap bay array by using the activity led as an identifier.
rnavarro