Navigate / search

Extend the lifetime of your hard disk in Ubuntu Linux

I’ve already read a while back about an article that laptop hard disks in Ubuntu may be experiencing an above average stress that it should be. I forgot about this when I started using Ubuntu on my notebook and only remembered about it when I recently read a Slashdot article entitled “Ubuntu’s Laptop Killing Bug Fixed“.

After reading the article, I sort of did an check on my hard disk to see if I have such a setup that affect’s the lifetime of my hard disk. I was surprised that my Ubuntu Intrepid based notebook that is fairly new has already gone through 5253 Load Cycles — that’s near the half point mark of the 10,000-count alarm point.

I also found out that even at the hdparm value of 128 when my laptop was in battery mode, it was experiencing 3 load cycle counts in less than a minute. Estimating from a 2-hour battery it can easily reach 600 load cycles.

I decided to read Spitzak’s procedure to how to work around the problem until a permanent fix that is suppose to be available in Ubuntu Jaunty is made available. Spitzak made a pretty good explanation of why it was happening.

You may have a different procedure for your Ubuntu system, but on my Ubuntu Intrepid system on a Compaq CQ20 the only change I had to do to maintain the value of 254 for “hdparm -B” is to edit the file “/etc/acpi/battery.d/90-hdparm.sh”.

The script is executed when my notebook goes into battery. I’ve pasted the affected portion in the script below:

if [ "$STATE" = "BATTERY" ] ;
then
  hdparm -B 128 $dev
else
  hdparm -B 254 $dev
fi

Instead of having the value of 128 in “BATTERY” mode, I decided to put the value of 254, resulting in the following:

if [ "$STATE" = "BATTERY" ] ;
then
  # hdparm -B 128 $dev -- orig, new value below used extend HD lifetime
  hdparm -B 254 $dev
else
  hdparm -B 254 $dev
fi

I’ve decide to comment out the old value and put a note for me to remember the changes.

I’ve posted this on my blog to remind me of this change on my setup and to share it with others who might be experiencing the same. I think it’s prudent to do the same checks to see if you need to make any changes to extend the lifetime of your notebook’s hard drive.

Gerry Ilagan

Gerry Ilagan is into mobile apps and WordPress development at @speeqs. He loves to write about electronics, the Internet of Things, mobile phones, and #crazyideas.

Comments

Gian
Reply

Hmm…sounds good. I´ll give it a look. However, I´m sure this will be adressed in the upcoming system updates.

Nithin
Reply

How do u know that your hard disk has already gone through 5253 Load Cycles.

gerry
Reply

Hi Nithin,

You’ll need to enter the following in a terminal session:

sudo smartctl -a /dev/sda | grep Load_Cycle_Count

It will show you the number. You might need to install smartctl by:

sudo apt-get install smartctl

Leave a comment

name*

email* (not published)

website