Linux – rebuild raid array mdadm command

commandfilesystemslinuxraid

I have created a raid array say RAID5 or RAID10 with four drives.
I wish to force resync of the same array, Please let me know the mdadm command for the same.

Also, in case of RAID1 (mirroring) what is being done as part of resync. Is it basically replication of same chunk of data in two drives?
Linux is the OS used.

Thanks.

Best Answer

To resync an mdadm RAID-1 (which, as you suspect, is block-by-block checking one drive against the other, and replicating one to the other when they differ) you can do

echo "repair" > /sys/block/md0/md/sync_action

substituting md1, md2, etc. for md0 as appropriate.

Whilst I can't testify to it, this kernel patch from 2008 makes it pretty clear to me that this is also intended to work for RAID-5.