You can initiate a scrub of a mdadm array with echo 'check' > /sys/block/mdX/md/sync_action
, and if a bad sector is found, it'll rewrite it automatically (from a mirror or from parity information for RAID5/6).
However if all blocks read successfully but are found to not be consistent, then this is regarded as a mismatch. In this case repair is complicated because mdadm cannot tell which mirror contains the correct data (RAID1/10) or whether it is data or parity that is corrupted (RAID5).
In theory this is not the case with RAID6 if I understand RAID6 correctly. Because double-parity exists, it should be possible to pinpoint where a single corruption is, whether it is data or parity.
- Is my understanding correct, should this be possible in theory?
- If correct, is mdadm able to repair this inconsistent data without guessing which block is corrupted?
md
does the repair by majority vote or not.drivers/md/raid5.c::handle_parity_checks6()
is unclear to me in that regard, it mentions validate parity in a comment but I don't see where this is actually done in the code. It looks more like it's just updating the parity instead, but I might be misreading it. I'm not a kernel programmer.