By default, mdadm performs an automatic integrity check of your RAID once a month (on or after the first Sunday to be precise). If you turn off the system prematurely though, the check will be aborted and started again the next month. If you ever need to start (or stop) a check manually, here are some handy commands to do that.
Manually starting a check
On Fedora, it doesn’t look like there’s a built-in script for this, but writing directly to sync_action will start an integrity check:
echo check > /sys/block/md0/md/sync_action
To stop one that’s already in progress, we can do this:
echo idle > /sys/block/md0/md/sync_action
As always, to keep an eye on its progress we can watch the output from mdstat (use CTRL+C to stop watching). I’m assuming here that md0 is your RAID device, replace as necessary.
watch cat /proc/mdstat
Partial scans and restarts
On larger RAID setups, the checking process can take some time and you may have to interrupt it. Thankfully there’s a way to ask the system to stop a scan in progress and leave it in a safe partial state, so it can carry on from that point at a later time. Sadly this doesn’t survive a full system restart, but here’s how we do that.
This command will stop the check, and freeze its current position. Start it again with the check command as above and it’ll carry on from there.
echo frozen > /sys/block/md0/md/sync_action
If you want to start again from the beginning manually, we can do this to reset the freeze point:
echo none > /sys/block/md0/md/resync_start
echo idle > /sys/block/md0/md/sync_action
Thanks for Voxel@Night for these tips.