diff --git a/scterc.sh b/scterc.sh index bd53166..2b76e47 100644 --- a/scterc.sh +++ b/scterc.sh @@ -13,10 +13,16 @@ # error handling. If SCTERC is unsupported, it increases the Linux I/O timeout # to 180 seconds. Adjusting timeouts prevents premature I/O failures during # extended error recovery, improving reliability. +# +# set scterc < timeout <= eh_timeout for predictable and efficient error +# handling ### -sct=70 # 70=7 seconds -fallback=180 # 180 seconds +sct=70 # 70=7 seconds +sct_timeout=15 # 20 seconds +sct_eh_timeout=25 # 30 seconds +fb_timeout=180 # 180 seconds +fb_eh_timeout=200 # 200 seconds for i in /dev/sd[a-z] ; do device=$(basename "$i") @@ -26,10 +32,13 @@ for i in /dev/sd[a-z] ; do # Check the output for "SCT Commands not supported" if echo "$output" | grep -q "SCT Commands not supported" ; then - echo $fallback > "/sys/block/${device}/device/timeout" printf "%s: no SCTERC support, using fallback. " "$i" + echo $fb_timeout > "/sys/block/${device}/device/timeout" + echo $fb_eh_timeout > "/sys/block/${device}/device/eh_timeout" else printf "%s: SCTERC set ok. " "$i" + echo $sct_timeout > "/sys/block/${device}/device/timeout" + echo $sct_eh_timeout > "/sys/block/${device}/device/eh_timeout" fi # Show device identification