GNU/Linux, Virtualization, Open Source, Oracle Fusion Middleware, Knowledge Management, troubleshooting & performance tuning tips.

Sunday, December 21, 2008

Ubuntu Kills your Laptop HD, Stop it!

It has been a known problem for Ubuntu since 6.06. I have no idea why it hasn't been fixed yet. It does affect 8.10 Intrepid Ibex. Maybe that's the price we pay for open source and freeware:)

I don't want to discuss the technical details about this issue again. For more info on this issue:
http://ubuntuforums.org/showthread.php?p=5031046

Normally, our laptop HD can handle 60000 Load_Cycle. I did see someone's Load_Cycle_Count hits 1 Million+ but his bloody HD is still working. So you'd better check your model specification to make sure.

Check if your HD is affected:

install smartmontools
sudo apt-get install smartmontools

smartctl -a /dev/sda | grep Load_Cycle_Count
193 Load_Cycle_Count 0x0032 092 092 000 Old_age Always - 87385

Check how fast the LCC is growing. In my case, the LCC grew 30-50 per hour before applying the fix...

If you feel the LCC grows too fast, try the command below and monitor if the LCC stops growing.
$sudo hdparm -B 254 /dev/sda

If it does help, we'll try to make this change permanent.

There are several workaround/fixes for this problem. I recommend using the ugly fix which is a script file hook up with acpi profile. It is easier to manage and roll back.

make a file named "99-hdd-ugly-fix.sh". The important thing is starting with "99".
Code:

$sudo gedit 99-hdd-ugly-fix.sh

make sure the file contains the following lines (fix it if you have PATA HDD):

#!/bin/bash
if on_ac_power; then
# on AC so don't do any head parking
hdparm -B 254 /dev/sda # you might need 255 or a different value
else
# either on battery or power status could not be determined
# so quickly park the head to protect the disk
hdparm -B 128 /dev/sda
fi

copy this file to 4 locations:

$sudo install 99-hdd-ugly-fix.sh /etc/acpi/resume.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/start.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/ac.d/
$sudo install 99-hdd-ugly-fix.sh /etc/acpi/battery.d/

By using install the file 99-hdd-ugly-fix.sh should have the x-bit set. Reboot and all these scripts will start taking effect.

Now it's done, LCC stops growing, peace of mind...

Again, I recommend reading this post before you start, it's very important that you understand what you are going to do. It's all on your own risk:)
http://ubuntuforums.org/showthread.php?p=5031046

In addition, I'll introduce how to check Load_Cycle_Count in Mac OS X and Windows.

Mac OS X
Install smartctl tool for OS X


Windows
Try Everest

About Me

Sydney, NSW, Australia
Keep Life Simple and Stupid:)

FriendFeed badge

Tags