Setting persistent SCSI timeout

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Issue

  • What is the preferred way to permanently tune the default timeout /sys/block/device-name/device/timeout?
  • The RHEL 5 manual describes the way to set SCSI disk timeouts in a persistent way.
  • How to configure the timeout in RHEL6,7,8 & 9?

Resolution

  • A file /etc/udev/rules.d/99-udev.rules containing the following rules will set the timeout permanently:

    ACTION=="add|change", SUBSYSTEM=="scsi" , ATTR{type}=="0|7|14", \
    RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'"
    

    Another rule without invoking a sub-shell would also work:

    ACTION=="add|change", SUBSYSTEMS=="scsi", ATTRS{type}=="0|7|14", ATTR{device/timeout}="60"
    
  • RHEL6 would support the same configuration as RHEL5, using the SYSFS keyword in the udev rule. RHEL7,8 & 9 requires the ATTR keyword which is also supported by RHEL6. The rules mentioned in this solution will work on RHEL6,7,8 & 9.

Diagnostic Steps

  • After adding or changing the rules, udev needs to be informed about changed rules:

    # udevadm control --reload
    
  • With the new rules activated, udev needs to re-enumerate the device

    # udevadm [--debug] test /block/<device>
    

    or

    # udevadm trigger /dev/<device>
    
  • cat /sys/block/sd*/device/timeout will also show the configured values:

    60
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments