On Mon, Jun 19 2017, Peter Sangas wrote: >> From: NeilBrown [mailto:neilb@xxxxxxxx] >> Sent: Sunday, June 18, 2017 2:35 PM >> Subject: Re: mismatch_cnt > 0 during initial sync? >> >> >> From the perspective of md, the initial sync is no different from any > other sync. It >> will count the number of mismatches that it finds and fixes. >> > > Should a sync always fix a mismatch it encounters? I have a RAID1 with 3 > disks. Sometimes I need to replace one disk and after adding a replacement > disk syslog indicates "RebuildFinished event detected on md device > /dev/md/2, component device mismatches found: 256 (on raid level 1)" but > says nothing about fixing it. No, it wouldn't say anything about fixing things. That is assumed. > > cat /sys/block/md2/md/last_sync_action > recovery This is a recovery, not a resync. They are different. Recovery is when you add a device to an array, and the data that should be there is recovered from elsewhere. Resync is when the redundancy in the array might be compromised, so it is repaired, possibly by read-check-maybe_write. Possibly by read-write. For raid1, recovery and resync and require similar. For raid5 they are very different. The mismatch count is only reset when a resync starts, not when a recovery (or reshape) starts. So mdadm shouldn't really report the mismatches when the recovery finishes. The number is left over from the most recent resync. raid1 only counts when a resync is requested, either by writing "check" or "repair" to the sync_action file in sysfs. An automatic resync after and unclean shutdown (or when array is started) just copies blocks without checking, so it has nothing to count. "repair" repairs any inconsistencies found, "check" doesn't. Both count inconsistencies. raid5/raid6 counts for resync, check, and repair (but not for recover or reshape). By default, when the array is created, raid5 performs a recovery, nominating one of the devices to be the "spare" with the others assumed to have "correct" data. This is faster than assuming they are all "correct", and performing a resync. RAID6 (the array used in the original question) does resync, rather than recovery, on initial creation - because 2-drive recovery is/was thought to have performance issues. So: mdadm should be modified to not report "mismatches found" is "last_sync_action" is recovery or reshape. Thanks, NeilBrown > > mdadm -V > mdadm - v3.3 - 3rd September 2013 > > > Thank you, > Pete
Attachment:
signature.asc
Description: PGP signature