RAID commands
Check the RAID setting by running the following command:
# cat /proc/mdstat
Personalites: [md5]
md0: active raid5 sdd1[2] sde1[3] sdc1[1] sdb1[0]
75469842 blocks level 5, 128k chunk, algorithm[3/3] [UUU]
Here, the first “3” in “[3/3]” indicates the how many devices in the array; the second “3” means active device numbers. If one device in array has been destoried, the second number would decrease “1”, for example, one disk failed, the second number is “2” as the result of “3-1”.
“UUU” marks the currently using device status. Assume /dev/sdb1 failed, it should be [_UU], at this point, the array runs in degrade mode without redundant.
“sdd1[2]”, assume “n” is the number of devices in array: if the number in “[]” is less than “n”, it means the device is active,else if the device is for backup. When one device down, the coresponding “[]” will be marked as “[F]”.
Mark the /dev/sdb1 as failed:
# mdadm /dev/md0 -f /dev/sdb1
Note, in this case, “/dev/sdb1” was component of “/dev/md0”.
Remove failed device:
# mdadm /dev/md0 -r /dev/sdb1
Add device to array:
# mdadm /dev/md0 -a /dev/sdb1
Start all arrays in “mdadm.conf”
# mdadm -As
Start idenfied array:
# mdadm -As /dev/md0
Stop array:
# mdadm -S /dev/md0
List detail information:
# mdadm -D /dev/md0