RTFM

[Read This Fine Material] from Joshua Hoblitt

How to force a “sync” or “repair” check of mdadm arrays

| 0 comments

It’s likely that your distribution already has mechanism(s) for periodicially running mdadm array checks but occasionally it’s useful/nessicary to force an immediate verifcation pass. A check of a Linux mdadm/device-mapper array is initiated by echoing a command into the coresponding sysfs attribute for the mdX device to be inspected.

There are two types of checks that can be run. A “sync” check that looks for and reports issues and a “repair” check that will attempt to resolve identified issues.

To run a “sync” check:

echo check > /sys/block/mdX/md/sync_action

To run a “repair” check:

echo repair > /sys/block/mdX/md/sync_action

See the RAID Administration page of Linux RAID wiki for more details.

Demo:

# for MD in /sys/block/md?/md/sync_action; do echo check > $MD; done
# cat /proc/mdstat 
Personalities : [raid1] 
md7 : active raid1 sdd1[0] sde1[1]
      1953509312 blocks [2/2] [UU]
      [>....................]  resync =  0.0% (705280/1953509312) finish=323.0min speed=100754K/sec
      
md0 : active raid1 sdc1[2] sdb1[1] sda1[0]
      513984 blocks [3/3] [UUU]
      
md5 : active raid1 sdc2[2] sdb2[1] sda2[0]
      36861056 blocks [3/3] [UUU]
      	resync=DELAYED
      
md4 : active raid1 sdc5[2] sdb5[1] sda5[0]
      16386176 blocks [3/3] [UUU]
      	resync=DELAYED
      
md1 : active raid1 sdc6[2] sdb6[1] sda6[0]
      12586816 blocks [3/3] [UUU]
      [>....................]  resync =  2.5% (324480/12586816) finish=1.8min speed=108160K/sec
      
md3 : active raid1 sdc7[2] sdb7[1] sda7[0]
      1020032 blocks [3/3] [UUU]
      	resync=DELAYED
      
md6 : active raid1 sdc8[2] sdb8[1] sda8[0]
      45287104 blocks [3/3] [UUU]
      	resync=DELAYED
      
md2 : active raid1 sdc3[2] sdb3[1] sda3[0]
      30716160 blocks [3/3] [UUU]
      	resync=DELAYED
      
unused devices: 

This is what the coresponding dmesg looks like:

md: syncing RAID array md0
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
md: using 128k window, over a total of 513984 blocks.
md: delaying resync of md1 until md0 has finished resync (they share one or more physical units)
md: delaying resync of md2 until md0 has finished resync (they share one or more physical units)
md: delaying resync of md3 until md0 has finished resync (they share one or more physical units)
md: delaying resync of md4 until md0 has finished resync (they share one or more physical units)
md: delaying resync of md5 until md0 has finished resync (they share one or more physical units)
md: delaying resync of md6 until md0 has finished resync (they share one or more physical units)
md: syncing RAID array md7
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
md: using 128k window, over a total of 1953509312 blocks.
md: md0: sync done.
md: delaying resync of md6 until md5 has finished resync (they share one or more physical units)
md: delaying resync of md5 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md4 until md1 has finished resync (they share one or more physical units)
md: delaying resync of md3 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md2 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md1 until md6 has finished resync (they share one or more physical units)
md: delaying resync of md5 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md4 until md1 has finished resync (they share one or more physical units)
md: delaying resync of md3 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md6 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md3 until md4 has finished resync (they share one or more physical units)
md: delaying resync of md4 until md1 has finished resync (they share one or more physical units)
md: delaying resync of md5 until md4 has finished resync (they share one or more physical units)
md: syncing RAID array md1
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for reconstruction.
md: using 128k window, over a total of 12586816 blocks.
md: delaying resync of md2 until md4 has finished resync (they share one or more physical units)
RAID1 conf printout:
 --- wd:3 rd:3
 disk 0, wo:0, o:1, dev:sda1
 disk 1, wo:0, o:1, dev:sdb1
 disk 2, wo:0, o:1, dev:sdc1

Leave a Reply