Table of Contents

NAS - Build a Linux NAS - Data Scrubing

To ensure that a rebuild will run smoothly without any data reading errors it is commonly recommended to do a data scrub/check daily or weekly.


Initiate a data scrub of the raid

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

Monitor the data scrub process

cat /proc/mdstat

returns:

Personalities : [raid6] [raid5] [raid4] 
md0 : active raid5 sda1[0] sdd1[3](S) sdc1[4] sdb1[1]
      1953520640 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
      [>....................]  check =  2.6% (26135552/976760320) finish=203.2min speed=77948K/sec
unused devices: <none>

Schedule a periodic data scrub

Configure a cron job.

0 3     * * Sun echo check >> /sys/block/md0/md/sync_action

NOTE: This example cron will perform a weekly data scrub at 3AM on Sundays.