2008-05-09

High frequency of disk load cycles in Ubuntu

Finally somebody wrote some useful stuff concerning the following problem plaguing Ubuntu 8.04:

High frequency of load/unload cycles on some hard disks may shorten lifetime - original report at https://bugs.launchpad.net/bugs/59695

Alexey Borzenkov on May 7th 2008, 23:49 wrote:

A note of observation. After I switched back to Windows XP I found that
Windows indeed didn't let my drive to spin down or park heads, however
all this came at the same price I had in Linux, i.e. frequent superclicks
and Load_Retry_Count increasing. So the problem is not with Linux or
Ubuntu at all, the problem is solely with the hard drive.

It is also worth noting that with Ubuntu I was able to reach any comfortable
increase rates by carefully tweaking /etc/laptop-mode/laptop-mode.conf.
The most important are ENABLE_LAPTOP_MODE_ON_AC=1,
LOST_WORK_SECONDS (the default value of 360 ensures only 10
Load_Cycle_Count per hour), READAHEAD (which in my opinion shouldn't
default to 3072, since huge delays every half or one minute between
reads effectively prevent playing videos, setting it to LM_READAHEAD=128
was the best in my case), IDLE_TIMEOUT (if you want your drive to really
cool down when idle, in my observation 60 seconds on AC was the best),
and WRITECACHE set to one (this adds another good layer of caching by
the hard drive).

Now don't forget to set ENABLE_LAPTOP_MODE=true in your
/etc/default/acpi-support.

BUT ALL THIS WON'T WORK unless you edit your /etc/acpi/power.sh and do
the following modifications:

Comment out all $HDPARM nonsense, since laptop-mode controls this for
you (provided you set your settings in laptop-mode.conf, of course).
Next, where you see "$LAPTOP_MODE stop" it should be "$LAPTOP_MODE",
WITHOUT STOP. The latter is very important, because when
"/usr/sbin/laptop_mode stop" is called it effectively TURNS OFF LAPTOP
MODE, even if you have ENABLE_LAPTOP_MODE=true in your
/etc/default/acpi-support. While calling "/usr/sbin/laptop_mode" without
arguments does autodetection, and depending on your settings will either
Without laptop mode "lost work seconds" do not work and this means that
mount option is not applied and pdflush will drop caches half a second
after some program (i.e. firefox) writes something to disk. The constant
writing to disk by many applications is what actually causes heads to
unpark, and when manufacturer sets some very ridiculous timeout for head
parking (i.e. 3 seconds in my case) heads keep unparking all the time.

I'm not sure if acpid is at fault here for calling laptop_mode with stop
argument, or laptop_mode not honoring your settings when stop is passed,
but current settings make laptop mode effectively useless. When I did
the above modifications and tweaked config files for my tastes I was
able to get rid of all problems. When my computer is idle heads park and
disk spins down, staying untouched for 6 minutes. When I'm doing
something active, like watching a movie, my drive is constantly accessed
and heads don't park needlessly. When I'm having a mix of the two (like
active browsing, or doing something else) my heads unpark only 20-30
times per hour, which I consider very good. And best of all, my drive
was not thermally abused and super clicks didn't happen.

As a comparison, average temperature of my drive under Windows was
41 degrees Celsius (and never below), under Linux it was 34-36 degrees
Celsius.

I consider that the main issue with this bug is that laptop mode (as it is)
DOES NOT WORK AT ALL. Please either fix acpid or fix laptop-mode.

Thank you.

I only wonder if this procedure really would work for me, but since I have a copy of his post here, I'll be able to test it eventually.

No comments: