Linux/SCT Error Timeout
SCT Error Timeout[edit | edit source]
The scterc.sh script configures error recovery settings for SCSI and SATA devices on Linux systems. It sets SCTERC (SCT Error Recovery Control) for supported devices or adjusts Linux kernel timeout settings for unsupported devices.
Linux uses the /sys/block/<device>/device/timeout
setting to determine how long the kernel waits for an I/O operation to complete before marking it as failed and invoking the SCSI Error Handler (EH). The /sys/block/<device>/device/eh_timeout
controls how long EH can attempt recovery before escalating further with high-level resets (such as LUN, bus, or host resets), or device offlining, which can cause data loss or file system corruption.
A device that supports SCTERC will limit its internal recovery/retry period and send an error response instead of trying too long. This prevents Linux from invoking the error handler, and informs the filesystem about the error so that it can take appropriate action.
Usage[edit | edit source]
Download the script from https://git.tnonline.net/Forza/misc/src/branch/main/scsi-timeout
The script iterates standard SCSI/SATA block devices in /dev/sd[a-z]
and attempts to set the SCTERC timeout value. If the device does not support SCT commands, the scripts sets a longer timeout to prevent Linux invoking the SCSI error handler. It can be modified to include other devices like /dev/vd[a-z]
(QEMU) or /dev/xvd[a-z]
(Xen).
Variable | Value | Description |
---|---|---|
scterc_value | 70 deciseconds | SCTERC timemout |
sct_device_timeout | 60 seconds | Linux device timeout |
sct_eh_recovery_timeout | 10 seconds | Linux EH timeout |
fallback_device_timeout | 300 seconds | Linux device timeout |
fallback_eh_recovery_timeout | 30 seconds | Linux EH timeout |
# ./scterc.sh
Device Model Status ------------------------------------------------------------------ /dev/sda WDC WD3000F9YZ-09N20L0 SCTERC set ok /dev/sdb KINGSTON SA400S37240G No SCTERC support, using fallback
Use grep
or cat
to see the current timeout values.
# grep . /sys/block/*/device/*timeout
/sys/block/sda/device/eh_timeout:10 /sys/block/sda/device/timeout:60 /sys/block/sdb/device/eh_timeout:10 /sys/block/sdb/device/timeout:60 /sys/block/sdc/device/eh_timeout:10 /sys/block/sdc/device/timeout:60
Dependencies[edit | edit source]
The script uses smartctl
tool from smartmon-tools to set and read device data.
License[edit | edit source]
This script is licensed under CC0-1.0 (Public Domain).
Further Reading[edit | edit source]
Small Computer Systems Interface, SCSI:
Linux SCSI interfaces guide:
Linux SCSI Error Handling Documentation:
- https://www.kernel.org/doc/html/latest/scsi/scsi_eh.html
- https://www.kernel.org/doc/html/latest/scsi/scsi_mid_low_api.html
Technical Committee for SCSI Storage Interfaces (T10):