Skip to content

Instantly share code, notes, and snippets.

@jimklimov
Last active October 6, 2021 15:57
Show Gist options
  • Save jimklimov/1f8ffd87b09bcfdcefeda7848cf9aced to your computer and use it in GitHub Desktop.
Save jimklimov/1f8ffd87b09bcfdcefeda7848cf9aced to your computer and use it in GitHub Desktop.
VirtualBox vHDD timeout
  • 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
  • Also maybe Linux udev:
# 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'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment