If I have a RAID array configured (using mdadm
), what's the best way of making sure I can tell which physical disk to replace in the event that one fails?
cat /proc/mdstat
will tell me that (say) /dev/sda
has failed. That's OK.
But when I look at the physical disks, which one is /dev/sda
?
If I use lshw -class disk
, I see it returns a logical name (eg /dev/sda
) and a serial number. If that serial number corresponds to the number given on the disk casing, and the logical name doesn't change, I could write both somewhere visible on each disk.
However, I see that for some reason the serial number given by lshw
is sometimes not the serial number given on the casing of the drive. I also suspect the logical name may change under some circumstances.
So is there a better way? Some script that can tell me which of the labelled disks to switch out, perhaps?
This answer recommending the use of the
ledmon
package seems to be the best one in my case.The use of
ledctl locate=/dev/sdX
is a foolproof way of knowing which drive to remove - although I might still have to do this by process of elimination ifledctl
could not see the failed drive.