Rebuilding failed drive in linux md raid

A drive in an Linux md raid array is failed and replaced.
As md raid will not rebuild your array by itself something needs to be done.

Using mdadm, it goes like this:

mdadm - -add /dev/mdX /dev/sdaY

where /dev/mdX is the array that has a failed member, and /dev/sdaX is a partition that needs to be added.

/dev/sda needs to be partitioned before though.

Then it is only a matter of time to see Your arrays being syncronized.

watch -n1 'cat /proc/mdstat'
That array can be in use during that syncronization process.

If You know, that a device, shown as failed should be ok and want to add it back to a md device, it must be removed first:
mdadm --remove /dev/mdX /dev/sdbY

and then added as described before.

Drive, that is growing the number of uncorrectable sectors, but has not failed yet, has to be marked as failed, before it can be removed from array. like so:

mdadm --fail /dev/mdX /dev/sdeY

Leave a comment

Your email address will not be published. Required fields are marked *