Steffen Hi, the name's Steffen and I'm writing about the Web, programming and all those things coming to my mind. Enjoy your stay.

I'm currently working on fabidoo.com - 3D Printing for everyone!

USB storage spin down

Here is a Ruby script that uses sg3_utils to automatically put a SCSI device into standby mode after a configurable idle time period. This also works with USB storage devices (tested with Linux Kernel 2.6.14, sg3_utils 1.11 on Gentoo Linux with an NEC PCI USB 2.0 controller and an external Samsung SP2514N hard disk in an ICY Box).

You can download version 0.1 here.

Please adapt it to your needs and simply add it to your init scripts so it will be started automatically when your computer boots.

Here’s an example for that on Gentoo Linux:

#!/sbin/runscript

start() {
  ebegin "Starting Rusi's SCSI standby daemon"
  start-stop-daemon --start -v --background --pidfile /var/run/rusi_sg_downd.pid --make-pidfile --exec /usr/local/sbin/rusi_sg_down
  eend $?
}

stop() {
  ebegin "Stopping Rusi's SCSI standby daemon"
  start-stop-daemon --stop -v --pidfile /var/run/rusi_sg_downd.pid
  eend $?
}

One Response to “USB storage spin down”

  • 1
    Adam Says:

    Thanks very much for this, works a treat.

  • Leave a Reply

53132