- Linux
/etc/init.d/virtualbox-hdd-timeout
:
#!/bin/sh
### BEGIN INIT INFO
# Provides: hdd-timeout
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Set up vHDD timeout for VirtualBox disks
# Description: Set up vHDD timeout for VirtualBox disks
### END INIT INFO
case "$1" in
start)
for D in /sys/class/scsi_generic/sg*/device ; do
grep 'VBOX HARDDISK' $D/model && echo 240 > $D/timeout
done
;;
esac
# cat /etc/udev/rules.d/90-vhdd-timeout.rules
### https://kb.vmware.com/s/article/1009465
#ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="VMware " , ATTRS{model}=="Virtual disk ", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"
#ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="VBOX " , ATTRS{model}=="VBOX HARDDISK ", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"
ACTION=="add", SUBSYSTEM=="scsi", ATTR{vendor}=="VBOX" , ATTR{model}=="VBOX HARDDISK", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"