Scrappy notes about RAID & mdadm

KMFDM MDADM

last modified on

contents…

Recover from a disk failure

Below is “what worked last time”, but there is more comprehensive documentation elsewhere.

Disconnect the existing RAID array:

$ mdadm --stop /dev/md127

Create a new array out of the working disks:

$ mdadm \
    --verbose \
    --assemble \
    --force \
    /dev/md0 \
    /dev/sdc1 /dev/sdd1

Try mounting it, check everything’s OK:

$ mount /dev/md0 /mnt/md0

Add the new disk:

$ mdadm --manage /dev/md0 --add /dev/sdb1

Watch it rebuild, and hope:

$ cat /proc/mdstat

Misc

Check the status of the array

$ mdadm --detail /dev/md127

Check the status of an individual disk

$ mdadm --examine /dev/sdb

Check the event counts match

$ mdadm --examine /dev/sd{a,b,c} | grep Event

Identify a physical disk

$ hdparm -I /dev/sda | grep Serial