Repository navigation
RAID Disc Scrubbing
kurtcoke edited this page May 15, 2015
·
1 revision
Linux RAID with MDAM:
- Software RAID Howto
- Data Scrubbing of RAID Array
- Keep RAID Array Healthy
- Why You Should Your RAID Arrays Regularly
- Arch Wiki RAID Maintenence
- How Often to Do Data Scrubbing
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md11 : active raid1 sda2[2] sdb2[3]
488058688 blocks super 1.2 [2/2] [UU]
md10 : active raid1 sda1[2] sdb1[3]
194368 blocks super 1.2 [2/2] [UU]
unused devices: <none>
1. RAID Scrubbing
2. Use S.M.A.R.T
RAID Scrubbing: (Very Simple Method)
"With a modern kernel, >=2.6.16, this command will initiate a data consistency check and a unreadable block check: reading all blocks, checking them for consistency, and attempting to rewrite unreadable blocks:"echo check >> /sys/block/mdX/md/sync_action"In short: Especially if you run a RAID5 array, trigger an active bad block check on a regular basis, or there is a high chance of hidden bad blocks making your RAID unusable during reconstruction."
Notice this version is different to the method in the blog. This one works.
#!/bin/bash
for f in /sys/block/md* ; do
echo check > $f/md/sync_action
done
# echo check >> /sys/block/md10/md/sync_action # echo check >> /sys/block/md11/md/sync_action
View process:
cat /proc/mdstat
One Liner to see RAID Arrays:
# for f in /sys/block/md*;do echo $f;done; /sys/block/md10 /sys/block/md11
Configure MDADM to notify server admin when there is something wrong with one of the hardrives:
sudo vim /etc/mdadm/mdadm.confThe sysadmin's email should be in this config file:
# This is /etc/mdadm/mdadm.conf MAILADDR admin@example.com ARRAY /dev/md/10 metadata=1.2 UUID=04040873:f375aaea:8dbdb090:cf7c93fa name=ubuntu:10 ARRAY /dev/md/11 metadata=1.2 UUID=51a93042:65a1dafe:20a0a873:a94a518e name=ubuntu:11
MDADM also has its own built in checking but only happens one Sunday of each month:
# /etc/cron.d/mdadm 57 0 * * 0 root if [ -x /usr/share/mdadm/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet;fi
I think that the script /usr/share/mdadm/checkarray does several checks on hardrives including data scrubbing.