Forcing a "check" on a Linux md RAID device

To be proactive, I've found that once in a while (perhaps via a cron job) it might be a good idea to force a Linux RAID (mirror or RAID5/6) to be checked for consistency. This can easily be done from command line, with something like

% sudo echo check >  /sys/block/md0/md/sync_action

Also, to repair bad raid device, perhaps something like

% sudo echo repair >/sys/block/md0/md/sync_action

This second command solved a problem for me, where I'd get an email warnings once a week, saying "WARNING: mismatch_cnt is not 0 on /dev/md0". This was verified with

% sudo cat /sys/block/md1/md/mismatch_cnt
256

 

Hacking: 

Comments

Re: Forcing a "check" on a Linux md RAID device

With my RAID volumes now running into the tens of terabytes in size (even though not even 50% full), this was getting to be obnoxious and it's not actually possible to tell which data is correct; is it the parity that's wrong or the actual block? And in a mirror configuration, which copy of the block is the right one?

I punted and switched to ZFS, which has a reliable way to reconstruct the data and it doesn't have to traverse parts of the pool that have no data.