Restoring a software RAID 1 on Linux
March 12, 2007
When one of the hard disks in a RAID 1 gets out of the RAID because it is no longer in sync with the other disk, you can easily resynchronize it with the following command:
raidhotadd /dev/mdX /dev/sdY
X and Y should be set to the appropriate values.
‘cat /proc/mdstat’ would tell you if your RAID system is healthy.
The configuration of your RAID is set in the file /etc/raidtab which will tell you the disks in the RAID and you can compare the results with the cat command above to see which disk is missing.
I use this script to verify if all disks in my RAID 1 are working fine:
#!/bin/bash
#Check if both drive are up
if [ `grep [UU] /proc/mdstat | wc -l` != 2 ] || [ `grep "2/2" /proc/mdstat | wc -l` != 2 ]; then
cat /proc/mdstat
exit 1
fi
exit 0
More info here.