Enabling Error Recovery Control in RAID Drives

Consumer hard drives typically make many attempts to read a bad sector, causing hangs in RAID arrays. A quick way to solve the issue without having to buy more expensive “RAID-compatible” drives is to enable error recovery control, setting a time limit on the retries. Some drives support this; others do not. What follows is a simple one-liner that, when added to the system crontab, sets error recovery control to 7 seconds in all the drives in the array that support ERC.

@reboot /bin/grep -o 'sd[a-z][a-z]\?' /proc/mdstat | /usr/bin/xargs -I '{}' /usr/sbin/smartctl -l scterc,70,70 '/dev/{}'

This line means that, at reboot, grep will identify all the sd? devices in the array and feed them one-by-one to smartctl, where the parameter scterc will be set to 70,70.


Subscribe to Ubuntu