i'd like to automatically spin down USB hard drives after a period of inactivity, say 15 minutes. And, of course, automatically spin them up again on access. How can i do this? Thanks
USB Hard Drive Spindown – Automatically Spin Down After Inactivity
hard drivespindownusb
Best Answer
hd-idle utility should be helpful
Please look at the source given below, read carefully and see if it helps:
Download source code with
CVS
using these commands:cvs -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle login
cvs -z3 -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle co -P hd-idle
Debians systems:
dpkg-buildpackage -rfakeroot
Usage:
Note: Please note that hd-idle uses
/proc/diskstats
to read disk statistics. If this file is not present, hd-idle won't work.Information:
Running hd-idle
In order to run hd-idle, type "hd-idle". This will start hd-idle with the default options, causing all SCSI (read: USB, Firewire, SCSI, ...) hard disks to spin down after 10 minutes of inactivity.
On a Debian system, after editing /etc/default/hd-idle and enabling it, use "/etc/init.d/hd-idle start" to run hd-idle.
Please note that hd-idle uses /proc/diskstats to read disk statistics. If this file is not present, hd-idle won't work.
Command line options
Regarding the parameter "-a":
Users of hd-idle have asked for means to set idle-time parameters for individual disks. This makes a lot of sense, not only because some [SCSI] disks may not react well to being stopped. Originally, hd-idle had one idle time for all disks. The parameter "-a" can now be used to set a filter on the disk's device name (omit /dev/) for subsequent idle-time settings.
A "-i" option before the first "-a" option will set the default idle time; hence, compatibility with previous releases of hd-idle is maintained.
In order to disable spin-down of disks per default, and then re-enable spin-down on selected disks, set the default idle time to 0.
Example:
This example sets the default idle time to 0 (meaning hd-idle will never try to spin down a disk), then sets explicit idle times for disks which have the string "sda" or "sdb" in their device name. Stopping hd-idle
Use
killall hd-idle
to stop hd-idle. On a Debian system, use/etc/init.d/hd-idle stop
.Source:
http://hd-idle.sourceforge.net/