Fix for Constant Hard Drive Clicking Noise in Ubuntu

If you are reading this it is probably because you have a laptop that keeps making a disconcerting clicking sound. You suspect that it may be the hard drive – and you are probably correct. It very well could be on its way out, and doing a full backup certainly can’t hurt anything… The racket could be something else though, it could actually be a feature of your hard drive. Let’s fix the “feature”!

You hard drive has heads that read the surface of the platters, and excessive head parking in Ubuntu Linux and its variants is not uncommon – especially on laptops running on battery power. Luckily for you, a simple command or two can narrow the problem down. First, go ahead and open up a terminal. Then, run the following command to set your disk drive’s power management to “off”:

sudo hdparm -B 255 /dev/sda

Note that if your laptop has multiple hard drives, then you will have to run the command once for each of them [sda, sdb, etc.]

Listen carefully (not to me, to your laptop!), has the clicking stopped? If so, then your problem is the head parking.

If not, well it still may be, re-run the command but use “254” in place of “255” since some drives do not respond to the latter:

sudo hdparm -B 254 /dev/sda

Great, if either one of these commands clears up your annoying clicking, then you can be pretty certain that you know what’s causing it and your hard drive is probably O.K. If not, go ahead and make that full back up, then head on over to Amazon and get yourself a new hard drive.

Unfortunately, even if the head parking is the problem… you still have the problem, because the command you just used to fix it isn’t permanent. You could devise some way to run the command every start-up, but, even then, you still wouldn’t be out of the woods.

Whenever you unplug or plug in your laptop Ubuntu runs a little script that can be found here: /usr/lib/pm-utils/power.d/95hdparm-apm and it will continue to wreak havoc on your hard drives heads.

Don’t fret just yet, you can override that script rather easily – simply by creating another (empty) script with the same name in /etc/pm/power.d/:

sudo touch /etc/pm/power.d/95hdparm-apm

That should do the trick nicely. At least, it will stop the power-saving head parking “feature” from becoming unreasonable. (It actually keeps the value at 254, the least aggressive setting, rather than disabling head parking completely. In most cases it is all you need.)

*** To completely disable the feature, you need to edit one last file located at /etc/hdparm.conf by adding the following to the very end of the file:

/dev/sda {
  apm = 255
  apm_battery = 255
}

 

Enjoy your more quiet hard disk!

You may also like...

12 Responses

  1. Karen says:

    This didn’t do anything. The maddening clicks are still there!

    I did every one of the suggestions above, in order, using copy-paste to be sure there were no typos, and the result was ZILCH. The noise is just as annoying and hair-pulling as before.

    :::sigh::: Will anyone ever figure out a solution to this?????

  2. romeophoto says:

    Thanks for this! Worked perfectly and my eeepc ist quiet again.

  3. FK says:

    Thanks!

    I’ve been trying to disable the clicking noise for several hours now and your little tutorial did the trick for me :-)

  4. develCuy says:

    If you are on XFS, write cache should be turn off as well (http://www.xfs.org/index.php/XFS_FAQ#Q:_What_is_the_problem_with_the_write_cache_on_journaled_filesystems.3F). So add the following to /etc/pm/power.d/95hdparm-apm

    #! /bin/sh
    hdparm -W0 /dev/sda

    then add execution perms:

    sudo chmod a+x /etc/pm/power.d/95hdparm-apm

  5. pepb says:

    Thank you very much.. It works on my ubuntu 14.04 64bit… The sound just scared me a lot, since I use a new laptop, which I think did not happen that constant on my older one…

  6. Anshul says:

    Thanks. Helped me !!

  7. Brilliant! This has bothered me for probably years now and I googled it and low-and-behold you have the solution. Worked great on my Asus A55V laptop. Now I can sit in peace at my desk!

  8. Pan says:

    THANKS SO SO MUCH! This made my day

  9. mariano says:

    It worked incredibly well for my. with my asus ultrabook, ubuntu 16.04 tls

  10. Jaime says:

    Thanks a lot, it worked!

  11. Ruwan Wedisa says:

    Thank you so much

  12. David sew says:

    @sudo touch /etc/pm/power.d/95hdparm-ap” is not working: cannot touch : no such file or directory.
    Please help.

Leave a Reply

Your email address will not be published. Required fields are marked *