Manually Starting or Stopping a RAID check in Linux

If you want to manually start or stop a RAID consistency check in Linux it’s quite simple.

Starting a check on md0:
[email protected]:~# echo check > /sys/block/md0/md/sync_action

Stopping a check on md0:
[email protected]:~# echo idle > /sys/block/md0/md/sync_action

If you’re using Debian (or a Debian based distro, e.g. Ubuntu), there is a script to do this.
[email protected]:~# /usr/share/mdadm/checkarray -h
checkarray -- MD array (RAID) redundancy checker tool
Copyright © martin f. krafft <[email protected]>
Released under the terms of the Artistic Licence 2.0
 
Usage: checkarray [options] [arrays]
 
Valid options are:
-a|--all check all assembled arrays (ignores arrays in command line).
-s|--status print redundancy check status of devices.
-x|--cancel queue a request to cancel a running redundancy check.
-i|--idle perform check in a lowest scheduling class (idle)
-l|--slow perform check in a lower-than-standard scheduling class
-f|--fast perform check in higher-than-standard scheduling class
--realtime perform check in real-time scheduling class (DANGEROUS!)
-c|--cron honour AUTOCHECK setting in /etc/default/mdadm.
-q|--quiet suppress informational messages
(use twice to suppress error messages too).
-h|--help show this output.
-V|--version show version information.
 
Examples:
checkarray --all --idle
checkarray --quiet /dev/md[123]
checkarray -sa
checkarray -x --all
 
Devices can be specified in almost any format. The following are equivalent:
/dev/md0, md0, /dev/md/0, /sys/block/md0
 
You can also control the status of a check with /proc/mdstat file.

For more information, please see the (almost always) wonderful Arch wiki article on RAID.

Author: [email protected]

Leave a Reply