Increasing write timeout on a hard drive / block device

I was having issues with my CentOS system a Hetzner VQ Server. It turned out the virtualization caused some device (hard drive) writes to timeout, which put the file system into read-only mode. Consecutively the machine would crash and upon reboot no services would start as they couldn’t write to their log files.

Here is how to fix it:

echo 180 > /sys/block/sda/device/timeout

Remember to change sda to your device. If you have multiple devices (sda, sdb etc) the command needs to be run separately for each of them.

The command will only last until reboot. To set it at startup, read this article.

Source 1
Source 2

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.