Verifying consistancy of an MD array under Debian
After running an MD array for a while it might be a good idea to verify that the drives has no faulty of out of sync blocks. Most installations of MD sets up a cron job that does this regularly but it can also be done maually or when an automated check is not configured. As far as I know the mdadm utility does not provide this functionality but commands can be initiated directly from the /sys/block/mdX/md structure instead. Lets say we have an array, md0, then the path will be /sys/block/md0/md. To check the array status we can do the following: # cat /sys/block/md0/md/sync_action If the array is healthy and not rebuilding or anything this should return "idle". To initiate a verification of the array we can write commands to this file. I will present two useful commands, "check" and "repair". The check command will verify all blocks of the array and report any errors in the syslog. To initiate a check run the following: # echo check > /sys/block/md0/md/sync_action This will start the verification of the array and the progress can be monitored in /proc/mdstat. # watch -n 0.5 cat /proc/mdstat No errors will be repaired during this phase. To do this another command is used. # echo repair > /sys/block/md0/md/sync_action This will perform the same check as the check command but will automatically repair errors if found and as before the errors will be reported in syslog. IMPORTANT! Make sure the array is in state idle before issuing a command.

Write a comment

Name

E-mail (not visible)

Comment


Code from above