MD mismatch count
Linux MD mismatch_cnt counts sectors rewritten, or that would be rewritten during check, when checking array redundancy.
The counter is in 512-byte sectors that were rewritten, or would have been rewritten during check. Because most RAID levels work in pages rather than sectors, it can exceed the actual errors by the number of sectors in a page. The mdadm 4.2 manual illustrates a failed 64 KiB comparison contributing 128 sectors, not proof that all 128 sectors differ. [1] [2]
The counter is reset to zero when a scrub starts. A mirror mismatch can involve unused or swap space rather than corrupted live file data, because a page being swapped out may change between the writes sent to each copy. A mismatch alone does not identify the correct copy. Repair writes new parity on RAID5 and RAID6 and copies one block over the others on RAID1 and RAID10, without independently establishing application correctness. [2]
sync_min and sync_max bound the checked range in sectors and must be multiples of chunk_size, while sync_completed reports the sectors already processed. A zero value alone does not establish a completed full-array scan; check is not guaranteed read-only for every RAID level. [1]
Relations
- related
- Data scrubbing, RAID 1, RAID 5, RAID 6, Parity inconsistency, Parity pollution, RAID consistency check
Advantages
- On a RAID5 or RAID6 array that was truly clean, a non-zero count points to a hardware problem, because software issues should not cause such mismatches. [2]
- Per-array sync_speed_min and sync_speed_max, in kibibytes per second, let a check run at a bounded rate. [1]
Limitations
- After repair the same count reflects sectors already rewritten, so the earlier inconsistent contents are not preserved for comparison. [1, 2]
- An array created with mdadm --assume-clean can be expected to report mismatches on its first check. [2]
Citations
- Linux 6.18 documentation: RAID arrays, sync_action, mismatch_cnt and sync limits
- mdadm 4.2 md(4): scrubbing and mismatches
Sources & caveats
- md is the Linux 6.18 admin-guide md page, re-read for the mismatch_cnt definition, sync_min, sync_max, sync_completed and the kibibytes-per-second speed limits.
- md4 is the mdadm 4.2 md(4) manual, re-read for the 64 KiB and 128-sector example, the reset at scrub start, the swap explanation and repair behavior per level.
- Documented Linux MD behavior; not a hardware measurement or a conversion from counter values to lost bytes.
- The stripe-unit entry links here because check range limits must be multiples of chunk_size, the per-device stripe unit.