Linux, Fedora 16: How to turn Advanced Power Management less aggressive (only if you really afraid about your hard disk)

Some people hear a click-clack noise while working on their notebooks running linux. The reason was found to be a too aggressive power management which could cause the hard disk die prematurely. Here is an article about this problem and possible solutions (in german): „Linux User“ 2012-01 „Bund fürs Leben“ page 66 ff..
On a ASUSTeK Computer Inc. notebook model A54C (see last recent article in this blog) which comes with an „Seagate Momentus 5400.6 / ST9320325AS“ hdd and runs Fedora 16 I decided to turn down the power mangament. There was no need for it (see this recent article). I just see no sense in a aggressive power management since I use to work when notebook is on power and switch it off when finished working. Furthermore, aggressive power management was used when the notebook runs on AC!
The Advanced Power Management was set to 128 by SMART software (that means by the hdd itself). I found this by executing:
$ sudo hdparm -I /dev/sda | grep „Advanced power management“
    Advanced power management level: 128
The value can range between 1 (= VERY agressive) and 255 (Advanced Power Management off). I decided to reduce it to 240. Don’t ask why this value – I just guessed. One one hand I want the hard disk to be capable to do some Advanced Power Management but I dont want it to be agressive. I avoided a value of 254 because someone observed his hdd running hot.
To have the change permanently we need to set it again after each power-off (I observed that this change was still available after reboot). _This is done by placing a command into the file /etc/rc.d/rc.local and run it as root. Running as root is done in my solution by setting the „s-bit“ for the /etc/rc.d/rc.local (for the user only, the file is owned by root of course). (The s-bit is a flag which allows a program to run with the rights of it’s owner.)
This are the steps I made to change the level of Advanced Power Management permanently (lines starting with $ means that I typed a command into terminal, lines without $ right below tell what the command print out):
1) Looking for file /etc/rc.d/rc.local:
$ ls /etc/rc.d/rc.local
ls: cannot access /etc/rc.d/rc.local: No such file or directory
/etc/rc.d/rc.local didn’t exist.
2) Find out how your hard disk(s) is (are) mapped. If you have only one hard disk in your computer it should be mapped as „/dev/sda“. Launch GSmartControl to check. I can see two drives:
  (A) „ST9320325AS“ (text following „Drive information“ starts with „/dev/sda“)
  (B) „CDDVDW SN-208BB“ (text following „Drive information“ starts with „/dev/sr0“)
Drive (A) is the hard disk. I did not try this with external drives!
3) Create a file named rc.local in your home folder. Use you favorite text editor e.g. Acessoires -> gedit for it. Put this two lines in the file (if your hard disk is mapped on „/dev/sda“ otherwise replace „/dev/sda“ by the mapping for your hard drive!!!):
#!/bin/bash
hdparm -B 240 /dev/sda
„240“ is the level of Adavanced Power Management you wish. Please note the the command „hdparm“ could kill your hard disk if used without knowledge. Thus I use the -B parameter with values greater than the default value only.
4) Open a terminal e.g. System -> Terminal and change into the folder there the file exists.
5) Give the file the proper owner and read-write-execute rights. Note that we need :
$ chmod 755 rc.local
$ chmod u+s rc.local
$ chown root:root rc.local
6) Now check the file. Mine looks like:
$ ls -l rc.local
-rwsr-xr-x. 1 root root 36 May  2 23:12 rc.local
7) Now copy this file into the folder where it will run when the machine boots. This command ask for the root password (the paasword you use to change something on the operation system e.g. install a printer):
$ sudo cp rc.local /etc/rc.d/
8) Reboot your machine.
9) Check if it has effect:
$ sudo hdparm -I /dev/sda | grep „Advanced power management“
    Advanced power management level: 240
If you want to try it just until next power-off:
$ sudo hdparm -B 240 /dev/sda
Check as written above.
With this value I observed counting the value of „193 Load / Unload Cycle“ (by GSmartControl) in 41 hours from 1080 to 1102. I could not observe any effect on battery runtime. This notebook (Asus A54C on Fedora 16) runs still 2 hours on battery. In opposite, turn down screen brightness has an effect on runtime for sure. One could also switch off wireless network if not needed (See installation report for Dell Latitude E4300 in this blog).

=-=-=-=-=
Powered by Blogilo

Veröffentlicht in Linux, Tools. Schlagwörter: , , . Kommentare deaktiviert für Linux, Fedora 16: How to turn Advanced Power Management less aggressive (only if you really afraid about your hard disk)