Linux Software RAID
Notes on how to manage software RAID in linux
Device Status
The following will give you a list of physical devices that are currently installed and recognized by the system.
# fdisk -lIf you need to get the status of all software RAID devices type the following as root.
# cat /proc/mdstat
Handling Device Failures
So you've gotten the dreaded Degraded Array Event message (or you've notice an array in degraded mode), now what? If you've planned accordingly you can just add your hotspare and remove the old disk from the array. Here's how you do that (assuming /dev/sda1 has failed and /dev/sdd1 is the hot spare):
# cat /dev/mdstat
Personalities : [raid1] [raid5]
md0 : active raid5 sdc1[2] sdb1[1] sda1[0](F)
34828288 blocks level 5, 256k chunk, algorithm 2 [3/2] [_UU]
...
# sfdisk -d /dev/sdb >/root/sfdisk.sdb
# sfdisk /dev/sdd </root/sfdisk.sdb
# mdadm --add /dev/md0 /dev/sdd1
# mdadm --remove /dev/md0 /dev/sda1