Spindown your hard drive when hdparm doesn’t work

On several Western Digital drives, hdparm doesn’t play so good. That’s why the hd-idle project was created. But hey, that’s C and not very flexible actually. Have a look at my Python rewrite here. It uses sg3_utils sg_start tool and it’s been successfully tested on SATA (over SCSI layer) devices. I don’t know if it’s going to work on pure SCSI devices (given the fact that they might not come back from spindown automatically, IIRC).

Feel free to deploy it on your home server, it really saves a lot of money on the electricity bill.


About lxnay

the creator of Sabayon Linux, Entropy Package Manager {Eit, Equo, Rigo}, Molecule release media buildsystem, Matter Portage buildbot/tinderbox and only God knows what else...

3 responses to “Spindown your hard drive when hdparm doesn’t work

  1. Stupot

    Why the recent dive into power saving, if I may ask?

    I considered worrying about optimizing my home server (45 watt quad core AMD), but when I look at the electricity used during the winter vs how much it used during the summer (Air Conditioning) the computer draw is negligible.

  2. Yes. it seems like using a util to reduce power consumption of your hd’s is a futile effort. (unless your in a bunker in antarctica running off a diesel genney). However if this increases hd life/reliability then im all for it. I have a SSD drive for my new laptop, and with ssd problems like idlespin fizzle and dissapear and in some cases are replaced by new issues.

    Are there any official distro recomendations/tips/packages/settings for ssd drive tweaking? I have read a few small guides witth tips regarding other linux flavors, some were universal, some tips were more distro specific.


  3. Mikeyb


    On some of my SATA drives, the STOP message sent by sg_start and original hd-idle doesn’t play well with smartctl at all… any attempt to query the drive wakes it up, thus preventing me from having monitoring tools running and disk spindown.

    I’ve tried spinning these disks down into an explicit standby powerstate using sg_start, but that command throws an invalid CDB field error, even if avoiding sg_start and directly sending the required SCSI command sequence using sg_raw.

    hdparm -y though puts the troublesome drives (a Seagate and a Maxtor) into a standby state that can still still have some smartctl queries run without spinup.

    I’ve hacked hd-idle to system call hdparm -y instead of doing a direct issue of the SCSI stop command. Might be worth looking at your script to see how it plays with smartctl / smartd…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

hello, twitter

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 583 other followers


%d bloggers like this: