Re: spin down disks on debianslug
- --- In firstname.lastname@example.org, "BxWen" <bxwen@...> wrote:
>i have edited this slightly to use Sg_start and am also calling this
> --- In email@example.com, "spikes_nslu2" <peter.spikes@>
> > hi all, I have managed to install the sg3-utils so i can use the
> > sg_start to stop my drives.
> > but i can't figure out a script to auto spin-down drives after x
> > amount of time, like scsi-idle does on unslung etc.
> > anyone willing or able to help?
> > many thanks.
> > Peter.
> Here's what I do to my gentoo nslu2:
> 1. root on a 1GB flash drive, a westerndigital 120G mounted at /external
> 2. vixie-cron runs the script every 15 minutes
> 3. the script checks the mount point /external with fuser. If it is
> not used, power it down.
> # Script to see whether argument is positive or negative
> echo "***************`date`********" >> /var/log/power
> t=`fuser -c /external`
> if test "$t"
> echo "in use" >> /var/log/power
> echo "not in use, power down." >> /var/log/power
> echo "`sdparm -C stop /dev/sdb`" >> /var/log/power
> echo $t >> /var/log/power
> echo "" >> /var/log/power
using crontab, seems to be working ok at the moment, and will report
will add it to the wiki later this evening.
# Script to see if external storage is being used
# if its not being used, place drive in idle
# to change to your own config, change /hd to your mount point
echo "***************`date`********" >> /var/log/power
t=`fuser -c /hd`
if test "$t"
echo "in use" >> /var/log/power
echo "not in use, power down." >> /var/log/power
echo "`sg_start --stop /dev/sdb`" >> /var/log/power
echo $t >> /var/log/power
echo "" >> /var/log/power
- CN wrote:
>> I also wrote my own version in C which I intend to clean up and publish,No, it's too unfinished to put on the wiki, but you can download it here as
> I am interested. Please post it on a new Wiki page,
a tarball or Debian package:
Run it like this:
# spindown-idle /dev/sda 600
to spin down after 600 seconds inactivity. (Drives other than /dev/sda are
not supported yet!)