How to synchronize Linux software RAID1

Aug 11, 2014 00:00 · 92 words · 1 minute read Linux

Sometimes we can see synchronization issues between disks in software RAID. We can verify the consistency of Linux software RAID disks by reading and comparing the corresponding blocks of each disk in the array. If a mismatch is found, the counter in the /sys/block/mdX/md/mismatch_cnt file is increased.

To see the number of mismatches between disks, we can use mismatch_cnt:

cat /sys/block/mdX/md/mismatch_cnt

We can trigger a manual check or repair via sysfs:

echo check >/sys/block/mdX/md/sync_action

or

echo repair >/sys/block/mdX/md/sync_action

Also, we can use the watch utility to monitor the progress:

watch cat /proc/mdstat