Search
Enter Keywords:
Home
OS X Script to Set Spindown Time for a Disk PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Michael Salsbury   
Friday, 03 June 2005

A power-saving and disk-life-saving aspect of modern operating systems is the ability to shutdown the hard disk drive when it is not in use.  This activity, called "spindown" occurs automatically any time the operating system determines that the hard disk drive hasn't been accessed in a while.

Normally, this is a good thing.  It reduces wear and tear on disk drives, lowers system temperatures (because spinning drives generate heat), and saves electric power.  But there are times when spindown can be a problem.  For example, if spindown is set to a very short value (like one minute), the drive may spin down more often than it should.  As a result, you might find normal activities on the Mac being much slower than you expect.  Paging through a Microsoft Word document as you read it, for instance, might take an unusually long time because the computer has to spin up the hard drive before it can read and display the next page.

The script below adjusts the spindown time for a disk.  If you enter "0" for spindown time, you disable spindown and the disk drive will always run.  This might be OK for a server that's running constantly and needs to respond quickly to requests at all hours, but is probably overkill for a desktop Mac, and would likely drain the battery of a Mac laptop very, very quickly.  A value larger than "0" will specify the number of minutes of disk inactivity the computer should wait before spinning down the hard disk drive.  For example, entering "csh setspindown 30" would cause the computer to wait for 30 minutes of inactivity before spinning down the hard disk drives.

To use this script, copy and paste the lines below into TextEdit.  Save the file as "setspindown" onto your Mac's hard drive.  Go to a Terminal window and navigate to the location of the file.  Enter "chmod a+x setspindown" to make the script executable.  When you want to use it, type "csh setspindown xx" where "xx" is the number of minutes you want the computer to wait before spinning down the hard disk drive.  If the computer prompts you for a password when you execute the script, the password it needs is that of an administrator.  If you don't have administrator permissions, you probably can't run this script.

This script has been tested in MacOS X 10.3.x and 10.4, and appears to work as designed.  No warranty of any kind is made by me that this script will work on your system, though I see no reason why it wouldn't.

#!/bin/csh
#
# Sets the spindown time for a disk.
# values > 0 specify the number of minutes before spindown
# value  = 0 means no spindown is done
#
#
# Updated: October 5, 2004
# By: Mike Salsbury
#
#
echo " "
echo "This script sets disk spindown time to 90 minutes."
echo " "
sudo pmset -a spindown $1
echo "Finished."


Related Blogs:

Related Links:

Last Updated ( Wednesday, 17 August 2005 )
< Previous   Next >

Main Menu
Home
Blog
Photos
Links
Search
Site Index
Feedback
Administrator
Featured Links
BlogInspiration
SpamToons
Shawn Prince's Blog
Jack Ludwig's Blog
Mike Cramer's Site
Fark
Slashdot
Woot!
Cigar Envy
John Kricfalusi's Blog
CigarBlog 101
Cigars 101 Forum
Sponsored Links


View Site Stats