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.

  1. Is my understanding correct, should this be possible in theory?
  2. If correct, is mdadm able to repair this inconsistent data without guessing which block is corrupted?
  • It's not really solvable... just because two parities agree that the data should be different, does not necessarily mean that the data is wrong. That said I don't know if 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. Jun 16, 2014 at 12:00
  • Thanks. The manpage says "If repair was used, then a mismatch will be repaired in the same way that resync repairs arrays. For RAID5/RAID6 new parity blocks are written" which implies there is no clever repair going on for RAID6 (even if it were possible).
    – user12810
    Jun 16, 2014 at 12:18

2 Answers 2


It is possible in theory: the data+parity gives you three opinions on what the data should be; if two of them are consistent, you can assume the third is the incorrect one and re-write it based on the first two.

Linux RAID6 does not do this. Instead, any time there is a mismatch, the two parity values are assumed to be incorrect and recalculated from the data values. There have been proposals to change to a "majority vote" system, but it hasn't been implemented.

The mdadm package includes the raid6check utility that attempts to figure out which disk is bad in the event of a parity mismatch, but it has some rough edges, is not installed by default, and doesn't fix the errors it finds.

  • "There have been proposals..." do you have a link to any?
    – user12810
    Apr 19, 2015 at 12:56
  • 2
    @JackDouglas, the most recent discussion I could find was from 2008: spinics.net/lists/raid/msg19084.html
    – Mark
    Apr 19, 2015 at 22:47
  • 2
    raid6check in the latest version can be set to automatically fix errors. It also reports where the errors are, and can be run to manually repair a specific stripe. And while it's not installed by default, it can be compiled and run separately from the rest of mdadm. Jun 2, 2018 at 5:37

The raid6check utility from mdadm includes a repair mode since version 3.3 (released on 2013-09-03) (more precisely since this commit: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=8a63c73123b9d022107c82bd684e17bf87bc081e)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy