Monday 30 April 2012

Calm that clicking laptop hard drive in Fedora

Every time I install a Fedora distro on a laptop, I have to stop the hard drive clicking every few seconds or so by fixing the over-aggressive Advanced power Management (APM) setting.

To provide a permanent fix, the setting needs to be applied every time it boots. Here's how to fix it once and forget about it:
  • Edit a new file /etc/rc.d/init.d/hdparm, with the contents (where /dev/sda is the noisy HDD of your choice)
#!/bin/bash
/sbin/hdparm -B 254 /dev/sda
  • Make sure this file has the correct permissions to be run:
$ sudo chmod 755 hdparm
  • Now create a link for the rc level for the hdparm script to run at startup:
$ cd /etc/rc.d/rc3.d/
$ sudo ln -s ../init.d/hdparm S80hdparm

Now on reboot, the hard drive should be much quieter, won't wear out as quickly and will allow you to get on with your work...but it will eat a little more power than before. You can change the hdparm -B xxx number to something a little lower if power use is an issue. To check that the changes are successful, run:

$ sudo hdparm -B /dev/sda
/dev/sda:
 APM_level = 254