How to change hdd read error timeout?

5

2

I'm recovering data from an hdd using ddrescue. With "retry" disabled, it takes roughly 30 seconds for every unreadable sector. The hdd has tens of thousands of bad sectors and the process is taking forever.

Can I shorten the read error timeout to, say, 3 seconds? Perhaps with ATA commands? Kernel options? Firmware hacks?

smartctl info:

Device Model:     Hitachi HTS542525K9A300
Firmware Version: BBFOC3EP
User Capacity:    250,059,350,016 bytes
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 3f

netvope

Posted 2010-11-25T14:16:18.923

Reputation: 4 505

Sorry to comment on such an ancient question. Did you ever find a solution to your problem? – Ryan Sorensen – 2014-07-16T00:54:36.440

Unfortuntely, no – netvope – 2014-09-21T02:00:13.733

Answers

4

On linux, /sys/block/<deviceName>/device/timeout (such as /sys/block/sda/device/timeout) is the timeout setting in seconds, which currently defaults to 30.

In the same directory, there is a eh_timeout value which is used for the SCSI commands TEST UNIT READY and REQUEST SENSE, so isn't what you're looking for.

As root, echo 1 > /sys/block/<deviceName>/device/timeout will change the timeout to 1 second. (Or, echo 3 for your 3 second example.)

As a non-root user, with sudo privileges, sudo bash -c "echo 1 > /sys/block/<deviceName>/device/timeout" will do the same.

user1902689

Posted 2010-11-25T14:16:18.923

Reputation: 152

1Thanks! I just used this successfully to reduce the wait time for using ddrescue on a USB connected SD card with several bad blocks. – GuitarPicker – 2017-11-09T05:29:40.133