This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Storage

Using spindown to prolong the life of old hard disks

By Ben Martin on April 22, 2008 (4:00:00 PM)

Share    Print    Comments   

Many people leave their computers on around the clock. This usually implies that all the attached hard disks are always spinning. Constantly spinning up a hard disk normally increases the chances of drive failure. When a disk is not powered it should last longer than if it was spinning. There is a delicate balance between having a hard disk spinning down and up too frequently and leaving it spinning around the clock. If you have a filesystem that you want to have near instant access to but do so on an infrequent basis, you might like to use spindown to automatically spin down the disk containing that filesystem after you have finished accessing the drive.

The spindown daemon keeps track of which disks it should try to spin down using their device IDs. Although the project description mentions that this is handy for using spindown on USB disks, I find it to be equally important for permanently attached disks. If you add a new drive and the old 80GB disk moves from being /dev/sdd to /dev/sde, you really don't want spindown to try to turn off your new 750GB fileserver drive just because it happens to appear at /dev/sdd. These are just the sorts of things that would be likely to happen 18 months after you initially set up spindown and add a new four-port PCIe SATA card, resulting in your drive letters being shuffled around.

I could find no packages for spindown for major distributions. I have made RPMs for Fedora 8 available on SourceForge.net.

spindown uses the sg_start command to start and stop hard disks. sg_start is available in Gutsy universe, via a 1-Click install for openSUSE 10.3, and in the Fedora repository as sg3_utils. Once you've installed sg_start from the standard repositories, building spindown follows the standard ./configure; make; sudo make install process. spindown itself does not use the autotools but is set up to accept the normal autotools build process. I used version 0.1.2 of spindown for this article.

After installing spindown you will have to create the configuration file /etc/spindown.conf. A sample configuration file is contained in the spindown tarball. It's an INI format file and includes a global section and a section for each disk you want to monitor and spindown. The global section has only two parameters: cycle-time is how often to check if a disk is idle, and idle-time is how long a disk must have had no access before it is to be spun down. If you are using spindown to control a rarely used filesystem, you might like to increase these two values from their defaults (60 and 3,600 seconds for cycle-time and idle-time respectively) to, for example, a cycle-time of 3,600 seconds and an idle-time of 64,800 seconds. That way, if you happen to access the filesystem again on the same day, the disk will still be spinning.

For each disk that you want spindown to monitor you need to create a [Disk N] section in the /etc/spindown.conf file. The default action is for spindown not to monitor and spin down any drives. You must specify spindown = 1 in each disk section to instruct spindown to monitor the disk. The other two configuration parameters that are the most important for each disk are its ID and what arguments must be passed to sg_start to spin the disk down. The disk ID can be found by listing /dev/disk/by-id. If you are using LVM, you can use df to see what logical volume a filesystem is on, lvscan to find out which physical volume contains that logical volume, and then pvscan to see what disk(s) contain the logical volume you are interested in. Alternately you can use the graphical tool system-config-lvm to find this information.

Examples for arguments used to spin the disk down include --stop and --pc=2. The pc argument to sg_start is used to specify the "power conditions" to the drive. If the value 2 (idle power condition) does not work, you may have to change the value you pass to --pc depending on what drives you are monitoring. The most important thing is to know that the disk is actually spun down after you issued the command -- that is, the disk has not entered an idle state where the platters are still spinning. See the sg_start manual page for details.

For testing purposes I set cycle-time to 15 and idle-time to 60, but you shouldn't use these values on a regular system, as they would lead to a significant number of disk spin up/down cycles per day. I did not require any special arguments to sg_start for the Seagate 500GB SATA hard disk that I wanted to spin down. The configuration file is shown below:

# cat /etc/spindown.conf [General] cycle-time = 15 idle-time = 60 [Disk 0] id = ata-ST3500630AS_9..... spindown = 1

With the above configuration in place I left the filesystems on ata-ST3500630AS_9... alone for 60 seconds and monitored what spindown was doing by issuing the status command through the init.d service file as shown below. When active=0 was reported I issued an ls command on a filesystem that I knew was stored on the drive. There was a multiple second delay as the disk was spun up before the listing appeared.

If you run the status command again right away to see which disks are spun down, you may see spindown reporting that the disk is still idle, because of the cycle-time interval and spindown not updating its status information until the next cycle starts. As the drive was mounted in an external enclosure I had the luxury of being able to feel the drive transition by placing my hand on the enclosure at about 55 seconds after the last access and waiting for spindown to perform its work.

# /etc/init.d/spindown restart # /etc/init.d/spindown status name watched active idle-time sdb 1 1 3 # /etc/init.d/spindown status name watched active idle-time sdb 1 0 66 # ls /.../filesystem-on-sdb ... wait a moment... ... listing appears... # /etc/init.d/spindown status name watched active idle-time sdb 1 0 119 ... wait a moment... # /etc/init.d/spindown status name watched active idle-time sdb 1 1 3

While hard disks will always fail, you might be able to keep a filesystem around on a RAID a little bit longer by spinning down disks when not in use. If you shuffle your data around to put infrequently accessed data on old disks that are spun down, you might have to spin up the disks only once every 3-6 months. With this approach, you get to have the data available quickly without manual interaction and also keep the disks in their dormant state when you are not interested in the data they contain.

Ben Martin has been working on filesystems for more than 10 years. He completed his Ph.D. and now offers consulting services focused on libferris, filesystems, and search solutions.

Share    Print    Comments   

Comments

on Using spindown to prolong the life of old hard disks

Note: Comments are owned by the poster. We are not responsible for their content.

Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 128.237.11.142] on April 22, 2008 07:10 PM
Thanks for the article. I've been wanting to do this forever now, and this might just get me to set it up.

#

hdparm?

Posted by: Anonymous [ip: 163.231.6.66] on April 22, 2008 07:17 PM
How is this different than hdparm -S?

#

Re: hdparm?

Posted by: Anonymous [ip: 192.139.122.66] on April 22, 2008 09:20 PM
Well, using hdparm -S requires that you have a clue about Linux.

What a moron! :)

And where is the proof that spinning down actually protects the life? Maybe the repeated power cycling will actually reduce the life of the drive.

The only good reason to power down old drives is that they're too noisy. Spinning down also makes sense in battery-powered systems.

If you're worried that the drive is near its end-of-life, replace it. Doh?

#

Re(1): hdparm?

Posted by: Michael Shigorin on April 22, 2008 09:30 PM
AFAIK spinning down (and then up) for no good reason *will* help the hard drive die faster and, well, harder.

#

spindown !i hav been looking for this forever!

Posted by: Anonymous [ip: 202.83.42.176] on April 22, 2008 11:14 PM
i didnt want 2 tweak with hdparm..but i had tasks which keeps my computer on unattended allthough the night without much hdd activity..and now i hav found it..thank you very much!

#

Re(1): hdparm?

Posted by: Anonymous [ip: 121.72.175.203] on April 22, 2008 11:49 PM
There are many, many causes of "spinning-disk" HDD failure, and the specifics are very lengthy. Many failures are mechanical for a variety of reasons including (but not limited to) vibration, inadequate heat dispersal, the use of poor quality materials, and poor manufacture/standards compliance (including design of/and component choices), whilst many failures can be attributed simply to the lack of design experience or a willingness to forgo quality-in-design for the sake of economics. I have even had problems with IDE interface compatibility between certain motherboard brands and HDD manufacturers. Age of any motherboard and HDD (spinning or not) and therefore tolerance shift, only tends to highlight and exacerbate such design errors.

"Maybe the repeated power cycling will actually reduce the life of the drive" - this is true in that the most likely cause of semiconductor failure is at a time when the component undergoes most stress, either through a domino effect from a fault condition elsewhere, or at times of initialisation or switch-on.

In summary, this is a very in-depth topic; IMHO, I would suggest each to his/her own; as non-spinning drives become more common, many issues (like spin-up/spin-down benefits/risks) will dissappear, some new ones will appear (esp with 3-dimensional storage), but many will remain as a testament to the widely varied causes of failure, pre-mature or otherwise.

#

Biggest risk on old drives is normally motor/bearing failure.

Posted by: Anonymous [ip: 58.179.93.99] on April 22, 2008 11:20 PM
If the drive stops spinning it can lock up instantly.

If this is making sure drive keeps on spinning at a lower speed it can stay running a little longer but not much. When a drive is done if you don't want to have to pay a recover bill to repair drive you get rid of drive. Doing this is only asking for pain.

#

Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 71.206.4.87] on April 23, 2008 03:31 AM
I've been around computers and servers nearly my entire life and, [in my experience] in general, leaving the drives running 24/7 significantly prolongs the life expediency of a drive. I have an old 386 20 MHz system that an on a UPS for nearly 10 years. The only reason I shut it down was to move to another house and I never bothered to set it back up. I'm sure it would still run today. In addition to this system, I had an email server run on a 486 DX2/66 that was also on UPS power. It too ran 24/7 for about 5 years. Ironically, when I switched the system off to upgrade the processor to an Evergreen Overdrive processor, the disk died. On servers that were shut down more frequently, drive life was substantially lowered.

I've had to replace desktop drives a lot more frequently than server drives. I attribute this to both the environment (people banging their knees into the desk, etc.) as well as more frequent shut downs.

I'm basing my non-scientific study on hundreds of servers and thousands of desktops that I've been exposed to in my lifetime. I'm sure others have more experience than I do, but this has been my experience.

#

Re: Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 64.3.206.218] on April 23, 2008 06:14 PM
I agree with you. Stopping and starting the motor is what's hard on the disk drive. We've got some Sun Ultra 5 pizza boxes that still have their original 6.4GB HD's in them (they run Ubuntu Dapper Drake these days instead of Solaris). They used to be Web content filter servers that stayed on 24/7, and we never had a hard disk failure. The only time I saw one taken out was not an HD failure, but rather a diode on the mobo actually caught fire! Yes, this was at power-up after a DRAM addition. :-)

It's like CRT televisions that stay on 24/7. Yes, they do use more juice when you leave them on all the time. But they also last longer, since you don't have those power surges going through them at power-on.

--TP

#

Re: Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 82.152.27.154] on April 24, 2008 05:23 PM
I've been around computers and servers nearly my entire life and, [in my experience] in general, leaving the drives running 24/7 significantly prolongs the life expediency of a drive. I have an old 386 20 MHz system that an on a UPS for nearly 10 years. The only reason I shut it down was to move to another house and I never bothered to set it back up. I'm sure it would still run today. In addition to this system, I had an email server run on a 486 DX2/66 that was also on UPS power. It too ran 24/7 for about 5 years. Ironically, when I switched the system off to upgrade the processor to an Evergreen Overdrive processor, the disk died. On servers that were shut down more frequently, drive life was substantially lowered.

I've had to replace desktop drives a lot more frequently than server drives. I attribute this to both the environment (people banging their knees into the desk, etc.) as well as more frequent shut downs.

I'm basing my non-scientific study on hundreds of servers and thousands of desktops that I've been exposed to in my lifetime. I'm sure others have more experience than I do, but this has been my experience.

--------------------

Nothing to do with servers using more expensive 24/7 operation certified drives that most OEM PC suppliers don't put in their desktops? For servers I 100% agree with you - but comparisons with the desktop segment is apples and oranges. At the end of the day, a hard drive is a physical chunk of metal spinning very rapidly on a bearing. Cheap desktop drives are made with cheaper physical components so don't last as long. For me it's like saying 'my cars engine wears the most in the first 10 minutes, so when I get home tonight I will leave it running all night'.

#

Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 147.162.84.150] on April 23, 2008 11:30 AM

Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 213.112.41.26] on April 24, 2008 05:26 PM
Having a drive spin down and up constantly is sure to shorten it's lifespan much faster than having it rotate constantly. This whole "article" is completely counterproductive and will only help kill drives even faster

#

Re: Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 212.83.73.150] on April 26, 2008 12:30 PM
You don't seem to have read the article past the headline.

Read the very first paragraph. It has this gem "There is a delicate balance between having a hard disk spinning down and up too frequently and leaving it spinning around the clock.".

Having a disk that is never accessed spinning around the clock does reduce its lifetime beacuse of waer and tear on the moving parts. Having a disk that is accessed every minute spin-up and down does reduce its lifetime because of spinup/spindown stress.

Somewhere between these two extremes is an optimum, depending on the access characteristics.

#

Using spindown to prolong the life of old hard disks

Posted by: Anonymous [ip: 81.100.216.178] on April 25, 2008 10:52 AM
Most of you guys are missing the point. A computer can have more than one disk. I personally have root partition and often accessed data on one disk and movies, music, games on another. Obviously, I can afford the second disk to be spun down most of the day.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya