Keeping my hard drive spinning

pingsmoth

Registered
I have a problem where my hard drive automatically spins down after a few minutes of inactivity, then starts spinning again after a few minutes, then stops again, and keeps repeating this pattern indefinitely. In my energy preferences i do not have the "spin down hard drive" option checked.

I have read that it's not good, as a rule, to have your drive be spinning up and spinning down like that, as it causes additional wear which can add up over time.

Is there any way to stop my hard drive from spinning down? Thanks!
 
I had this very problem. I'd set up a machine with Apache, PHP and mySql, and every time a user would connect after several minutes of idle time (hey, it's not a high-volume site :) ), it would take forever for the page to display in their browser. Other times, it was nearly instant if the drive hadn't spun down.

What I did is create a little script that I could run in cron to touch each drive in the system that I wanted to keep spinning. Here is that script:


#!/bin/ksh
set -A volumes "/" "/Volumes/Jujuflop/" "/Volumes/Towel/"
datestamp=`date "+%y%m%d%H%M"`

for i in ${volumes[@]}
do
tickler="$i""touchfile.$datestamp"
echo $i $datestamp
touch $tickler
sleep 2
rm "$tickler"
done


You will probably want to change the second line. I really hope you don't have the same volume names that I do.. :) Simply replace the names (or remove them) as needed. You should probably keep the root ( "/" ) drive there, though.

Then, in cron I added this line:

00,10,20,30,40,50 * * * * /home/kenkl/bin/touchdrives.sh >> /home/kenkl/bin/touchdrives.log


The 10-minute interval wasn't always enough, but it was usually good enough that no-one ran into the long page loads much any more. You could make this as little as every minute if you wanted.
 
My drives are constantly spinning down. Maxtor 60gb and 30gb. It is driving me nuts and I hate the 2-4sec freeze it puts on my system.

Is there another alternative then the one above? That seems like a work around but not a fix?
 
Back
Top