hdparm Service

Maybe you know this scenario: You boot Vista on your laptop and start noticing that the hard-disk starts to whine and stutter after a while. It drives you nuts because you know exactly that Vista spins the disk up and down and up and down [and so on].

Description

There’s a lot of software out there promising a solution, much of it costs you a little and/or is too overloaded with other crap you don’t want/need. Thank god, there is hdparm for Windows (you need to install this tool if you want to use the service!) as well and it works reasonably well with Vista.

Now, due to Vista’s UAC putting a batch calling hdparm into your startup folder is not so easy, it’ll prompt you for elevation every time you start the machine. Also, when hibernating/waking up your laptop the changes have to be redone.

I was a little sick of that and wrote a very simple service that will do nothing but call hdparm, set -B and -S values and waves you goodbye. After hibernation/sleep the service will do the changes again. So you’ll lose the ability to park your disk every 15 seconds but who cares?

Prerequisites

License

The program is free, open-source software and can be used, modified and distributed freely in any form and environment (including business/corporate use) as long as you offer the source-code along with the program free of charge.

Downloads

This time around there’s two packages:

  • hdparmservice1001_bin is the binary-only package of the service containing a nice installer that’ll copy the files to %PROGRAMFILES%\hdparm\bin (so you better install hdparm there!)
  • hdparmservice1001_src contains the source-code to the program. There’s not much to see, though. The service is really simple and was done in about 5 minutes so don’t expect any wonders from it 🙂 .
  • hdparmService_DMAMode is a special version for ALADO (see comments) that also supports setting the DMA mode. You need .net Framework 3.5 installed to build this, it’ll run on Framework 2.0 though.

Version History:

  • 08-20-2008: Small fix that should address the wake-up issues that I overlooked.
  • 05-29-2008: First version for public consumption.

16 Responses to hdparm Service

  1. Tom says:

    This fix should be posted on the MS Download Center main page! One quick question: On Vista x64, I had to copy/paste my ‘hdparm’ folders from ‘program files (x86)’ to ‘program files’ in order to install the fix. Then I copied your files back to the original ‘hdparm’ folder (/program files (x86)/). I also edited the hdparm.XML to match the proper location. Is that adequate to ensure your fix will still work?

  2. Tsukasa says:

    [quote comment=””]This fix should be posted on the MS Download Center main page! One quick question: On Vista x64, I had to copy/paste my ‘hdparm’ folders from ‘program files (x86)’ to ‘program files’ in order to install the fix. Then I copied your files back to the original ‘hdparm’ folder (/program files (x86)/). I also edited the hdparm.XML to match the proper location. Is that adequate to ensure your fix will still work?[/quote]

    Yes, as long as the xml configuration has been altered to reflect the changes, it should work without any problems.

  3. jerep6 says:

    Pour installer le service sur Windows 7 64 bits :
    To install the service on Windows 7 64 bits:

    —– Français —–
    1- Installer hdparm

    2- Couper/coller le répertoire d’installation de hdparm C:\Program Files (x86)\hdparm dans C:\Program Files\

    3- Installer le service

    4-Editer le fichier hdparm.xml (dans le dossier d’installation)
    C:\Program Files (x86)\hdparm\bin\hdparm.exe
    DiskIdentifier => sda pour le sata et hda pour de l’IDE

    5- Couper/coller le répertoire C:\Program Files\hdparm dans C:\Program Files (x86)\

    6- Modifier le chemin d’exécution du service dans le registre : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HDParmService\ImagePath => “C:\Program Files (x86)\hdparm\bin\hdparmservice.exe”

    7- Reboot

    —– English —–

    1- Install hdparm

    2- Cut/paste the install directory of hdparm C:\Program Files (x86)\hdparm in C:\Program Files\

    3- Install the service

    4- Edit the file hdparm.xml (in the install folder)
    C:\Program Files (x86)\hdparm\bin\hdparm.exe
    DiskIdentifier => sda for sata and hda for IDE

    5- Cut/paste the directory C:\Program Files\hdparm in C:\Program Files (x86)\

    6- Modify the execution path of the service in the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HDParmService\ImagePath => “C:\Program Files (x86)\hdparm\bin\hdparmservice.exe”

    7- Reboot

  4. Pingback: Aspire 5943 G - friert alle 15 Sekunden ein - Seite 3 - Acer-Userforum.de

  5. Tim Tim says:

    The service is indeed useful! I was almost owned by hdparm when trying to get it start on boot.

    However, how can I modify it such that it adjusts the UDMA transfer mode instead of the standby time?

  6. Tim Tim says:

    I have modified the source and it serves the purpose well. Thanks a lot again!

  7. ALADO says:

    Hi,

    If I just want to adjust the UDMA transfer mode, how could I do? Thanks

  8. Tsukasa says:

    Heya ALADO,

    if the Windows version allows it something along the lines of hdparm -X”udma{0,1,2,3,4,5}” -d 1 /dev/{hdX,sdX} should help.

    The service doesn’t allow to set any other values than the ones in the XML configuration by default, so you’d have to make minor modifications to the source-code to make this additional parameter work.

  9. ALADO says:

    I didn’t quite understand. My situation is that I could revise the UDMA transfer mode by writing a command “hdparm -X udma6 hdb” in a cmd file. However, it can’t run when windows 7 boots up. I ran well when it was XP. However, if I ran it manually, it works fine. So it looks similar to your problem. But I don’t know how to change the codes into my situation…

  10. Tsukasa says:

    Heya ALADO,

    I’ve modified and uploaded a special version for you. You can build the solution by running Build.cmd, the built service will be in hdparmService\bin\Release.

    Notice the new ParameterX node in the hdparm.xml (which is empty by default). Set it to udma6 and save.

    Grab the files from the Release directory and throw them into the normal installer’s Data directory, overwriting the old ones, so it’ll install the X-enabled version instead of the normal one.

    Hope it’ll help. 🙂

  11. ALADO says:

    I will try it, thanks a lot!!!!

  12. ALADO says:

    First of all, thanks for helping me. I tried the file and revised the “hda” to “hdb” since I want to setup the second hard disk. And I added “udma6” in the parameter X column and save it. I followed the steps mentioned above, but it didn’t work when I reboot it. So is anything wrong with my setup?

  13. Tsukasa says:

    Heya ALADO,

    maybe the command-line I put into the source-code isn’t the right one.

    You can try this: Since you have a manual command-line that works for you, open up clsService.cs, go to the line ‘objHdParm3.StartInfo.Arguments = “-X ” + objConf.ParameterX + ” ” + objConf.DiskIdentifier;’ and replace the part behind the “=” with your own command-line, run the Build.cmd and try again.

    Apart from that there’s also the possibility of running the command through Windows’ task scheduler (which will allow it to run elevated). If you want to give that way a go, do the following:

    – Open start menu, right click on “Computer” and choose “Manage”. A new MMC console should open.
    – Go to “Scheduled Tasks” (should be directly visible in the treeview on the left).
    – Right click on it and choose “Create new Task”, give it a name, tick the checkbox “Run with highest priviligues”, add an action (i.e. a link to a batch file containing the call to hdparm) and add a trigger to run the command i.e. whenever you unlock the computer.

  14. Alex says:

    Very nice service and it does the job nicely. Unfortunatly on my laptop the settings are lost after sleep. So if I enter sleep mode, then the hard disk clicking is back. In my case settings are saved on restart,but nothing more. Thanks to the author anyway, nice job:)

  15. Nakzynski says:

    Hey,
    I recently bought a WD20EARX, which suffers from the 8 second head park time. I would like to adjust the time to 20 minutes, but I’m not sure how to configure hdparm-service for this. So far, all I have done is install hdparm and hdparm-service.

    The drive is connected to the fifth SATA-port on my motherboard, so I guess the DiskIdentifier is sde? And since I want to increase the time to 20 minutes, I have to choose 240 for ParameterS?

    What else do I have to do in order to successfully start the service?

    With best regards

  16. Esther says:

    Could you have a version that runs hdparm for multiple disks?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.