Ubuntu – How to physically identify a single drive in a RAID array

diskraid

I have an external drive bay with 4 eSATA disks in it. My system has a 4-port eSATA card, as well as a pair of internal hardware RAID1 drives. The external drives are in software RAID1 pairs as /dev/md0 and /dev/md1. Both have been configured as LVM physical volumes to create my storagevg LVM volume group. Recently, a single drive went offline (I suspect cables), but there does not seem to be a good way to physically identify which drive I need to check, especially since initialization order isn't the same between boots. How can I find the disk needing attention?

Best Answer

Disk Utility (sitting in System -> Administration) will give you the serial numbers for all your disks.

Here's what I see (look at the top-right for the serial). You'll notice that this drive is within a mdadm RAID array. Disk Utility can penetrate the array for raw disk access.

Disk Utility

I have 6 of the same model of disk in my PC so I drew a little diagram showing their position in the case and the serial number so I can locate them quickly on serial in an emergency.

The opposite is also true in that if a disk dies, I just need to find which disks are showing up and I can eliminate them until I know which serial is missing.

Edit: I'm trying to improve my bash-fu so I wrote this command line version to just give you a list of disk serial numbers that are current in your machine. fdisk may chuck out some errors but that doesn't taint the list:

for disk in `sudo fdisk -l | grep -Eo '(/dev/[sh]d[a-z]):' | sed -E 's/://'`;
do
    sudo hdparm -i $disk | grep -Eo 'SerialNo=.*' | sed -E 's/SerialNo=//';
done

(And you can crumble that into one line if you need to - I've broken it up for readability)

Edit 2: ls /dev/disk/by-id/ is somewhat easier ;)