Ubuntu's Laptop Killing Bug Fixed
jeevesbond writes "Back in October of 2007 we discussed a bug that would dramatically shorten the life of laptops using Ubuntu. Ubuntu users will be glad to know that a fix has finally been released for Ubuntu versions 9.04, 8.10 and 8.04 (LTS). However, as this fix is not yet in the update repositories, anyone wishing to test it should follow these instructions for enabling the 'proposed' repository. Report your results on the original bug report. Happy testing!"
The fix is already included in the accepted updates:
acpi-support (0.114-0intrepid1) intrepid-proposed; urgency=low
* {ac,battery,resume,start}.d/90-hdparm.sh: don't just check whether
laptop-mode is configured to control the drives, also check whether
laptop-mode itself is *enabled*. Finally closes LP: #59695.
-- Steve Langasek Mon, 05 Jan 2009 10:50:10 +0000
Just run apt-get update && apt-get install acpi-support.
The funny thing is that the actul bug is an urban myth. People claim that once your hard drive reaches 300k parks it will fail. Note that at the start they were claiming the number to be 100k and now are claiming 600k due to the simple fact that a huge number of people showed up with the number being well over million on perfectly functioning drives.
The drives parked heads when not in use, sometimes, several times a minute, some of them clicked when they did so. It is a feature that reduces power use and protects the hard drive from sudden movement and impacts. It is NOT a bug.
All the claims that it will make you hard drive fail in a year are false and are made by people that have no a slightest clue of hard drive design.
FIX UBUNTU HARD DISK CYCLING HOW-TO:
/etc/laptop-mode/laptop-mode.conf, where you can individually set it on/off for battery, ac, and when the lid is closed. Change them all to zero there if you are worried. It works fine on my machine, however, and the battery lasts far longer now.
/etc/laptop-mode/laptop-mode.conf and change correct line to read: CONTROL_HD_POWERMGMT=1 (this makes laptop_mode call hdparm)
/etc/default/acpi-support and change correct line to read: ENABLE_LAPTOP_MODE=true (this makes power.sh run)
/etc/acpi/power.sh
/etc/pm/power.d/laptop-tools and make it read "exit 0" and then "chmod +x" it. (this stops suspend/resume from messing with hdparm settings)
/etc/pm/sleep.d/10laptop_mode_restart and make it contain the following:
/etc/init.d/laptop-mode stop
;;
/etc/init.d/laptop-mode stop
;;
/etc/init.d/laptop-mode start
;;
/etc/init.d/laptop-mode start
;;
;;
/dev/sda | grep "Adv"
/dev/sda | grep Load_Cycle_Count
The laptop_mode command does the right thing, so most of this is to get it called everywhere it needs to be, and to remove calls that mess with the hdparm settings and thus defeat laptop_mode. There are claims that "laptop mode" causes problems, but this does *not* enable it. The program "laptop_mode" does other stuff besides the problem part. That is controlled by a line in
1. Edit
2. Edit
3. Edit
Comment out or delete the 4 for...done loops containing $HDPARM commands. (this stops power-on from messing with the disks)
And change the arguments to $LAPTOP_MODE from start/stop to "auto" in both cases.
(this makes it run the laptop_mode command correctly rather than forcing the mode on and off)
4. Create
5. Create
#!/bin/bash
case $1 in
hibernate)
suspend)
thaw)
resume)
*)
echo Something is not right.
esac
Chmod +x this file (this makes suspend/resume run the laptop tools)
HOW TO TEST:
This command will tell you how your disk is set:
sudo hdparm -I
The correct results to stop disk thrashing are 254 or 255. When laptop_mode is *really* on then the correct value is 1. If you see 128 then things are not working, this is the setting the disk resets to on suspend/sleep/power off.
This command will tell you how bad you have trashed your disk (you may need to install "smartctl"):
sudo smartctl -a
The last number is how many times your disk has parked. Over 10,000 is not good. Mine is 101187 before I finally got this fixed.