Error Recovery Control (ERC) is the standard term (as used in the ATA standard) for Western Digital's TLER. For hard drives used in RAID configurations, it ensures the hard drive reports read/write errors earlier than it normally would, giving the RAID hardware a chance to handle the error as a temporary error, rather than consider the hard drive unresponsive and drop the hard drive altogther.
Western Digital have released (some say leaked) WDTLER, an MSDOS utility to set the TLER timers for read and write operations. This is WD specific, and being MSDOS, is hardly convenient, regardless of surviving a power cycle.
Some chance reading pointed to http://www.hdat2.com and a user asking to support Error Recovery Control as seen in the ATA specification. The HDAT2 author implemented it as requested. But, this is a Windows program, and the settings don't survive a reset, so I needed a Linux equivalent.
Given the ATA specification describes Error Recovery Control commands, HDAT2 says it is implemented and working, and there is the option to modify an existing project, I decided to modify smartmontools to support ERC. This involved extending the existing command set as Smartmontools already includes some SCT commands, and ERC is part of SCT.
A patch against smartmontools SVN, downloaded on 2009-11, has been submitted to the smartmontools mailing list. In the
meantime, the patch and the full version are provided here. Also provided is a patch for the Highpoint rr232x driver,
against v1.10 .
Note, the patch has been merged into smartmontools SVN, v5.40, I recommend you download that.
These examples demonstrate querying a drive using the supported IO drivers.
smartctl -l scterc /dev/sda - query ERC using SCSI-ATA pass-through
smartctl -d sat -l scterc /dev/sda - query ERC using SCSI-ATA pass-through
smartctl -d hpt,1/1 -l scterc /dev/sdb - query ERC on a Highpoint RR232x card, using HPT pass-through
smartctl -d ata -l scterc /dev/sdb - query ERC on a Highpoint RR232x card, using ATA pass-through
For WD enterprise drives, such as Raid Edition and Raptor, these will most likely report values of 7 seconds for both read and write. For desktop drives, a value of 0 will be reported, meaning disabled. Note that using a ERC enabled drive as a single non-RAIDed drive is a bad idea, ERC tells the drive to fail a read/write command earlier than it normally would have. A RAIDed system can rebuild the missing data from other drives, but a single drive has no option and would just report a read/write error. You really want it to try as hard as it possibly can.
Setting the timer can be done with:
smartctl -l scterc,70,70 /dev/sda - set read and write ERC to 7 seconds
smartctl -d sat -l scterc,70,70 /dev/sda - set ERC using SCSI-ATA pass-through
smartctl -d hpt,1/1 -l scterc,70,70 /dev/sdb - set ERC on a Highpoint RR232x card, using HPT pass-through
smartctl -d ata -l scterc,70,70 /dev/sdb - set ERC on a Highpoint RR232x card, using ATA pass-through
Example of disabling the timers:
smartctl -l scterc,0,0 /dev/sda - disable read and write ERC
Have recently bought Western Digital 1.5TB Green Power drives, with a model number of WD15EADS-00P8B0 and firmware of 01.00A01. They do not support ERC/TLER, although they still claim to be ATA-8. Cleary this was a deliberate change to force a move to their much more expensive RE drives. Searching around, the P is the indicates a lack of support, when the P was S, TLER/ERC etc worked. This change occured around 30th September 2009.
Cleary you need to be careful when buying drives, like WD, any maker can withdraw a feature without mentioning it.
The meat of this patch extends the WRITE_LOG command to return the ATA registers back to the higher level code. As it was, smartmontools had some provision for returning 512 byte sectors as results of ioctl()s, but not the contents of the ATA registers. Before ERC appeared, no other ATA commands return a result in this way. When a read or write ERC time is requested, the current ERC value are returned in SectorCount and LBA_Low, as a low and high byte. The number is in deciseconds.
Have also extended the man page, the command line options and the SCT capabilities reporting.
This has been tested on Hitachi HDP725050GLA360 (500GB), Western Digital WD20EADS (2TB GP) and Western Digital WD2002FYPS (2TB RE4-GP). It has also been tested to not break existing functionality. ata, sat and hpt devices are supported.
Unlike WDTLER, changes to the ERC options are lost after a reset or power-loss.
To work with High Point controllers (I tested the RR2320), the rr232x driver must be patched to pass back the results of a TASKFILE ioctl(). This patch enables -d ata and -d hpt,x/y access modes. Without the patch, scterc, amongst others, fail with an EPERM error.