Gutsy kills your laptop drive

Cefiar cef at optus.net
Thu Nov 8 07:35:01 GMT 2007


On Thursday 08 November 2007 11:38:50 Daniel Mons wrote:
> Running Gutsy 32bit on a Lenovo 3000 N100 laptop here.  I don't have the
> problem at all.
>
> And again, for those who do, change your default BIOS settings to be
> more sensible, and the problem goes away.

It's not so much a fault of the PC's BIOS, as it seems it's a fault of the 
actual drive's firmware. If you're lucky, then the BIOS can set this for you, 
but most don't. Eeven if they do, the option to do it might not have a name 
that correlates to the result you want or think it should.

The issue is that the drive BY DEFAULT, has power saving settings that spin it 
down regularly. This varies by drive and power setting. On my Hitachi 
Travelstar, it had an APM setting of 128 by default. For note, 1 is the most 
agressive setting, and 254 is least agressive setting. Setting the value to 
255 SHOULD disable the feature, but it seems that with many drives out there 
this behaviour is broken. In my case, if I set it (using hdparm) to 255, it 
stays at 128 (or whatever the last setting was)!

So for a start, the drives spin down regularly. Not so good. But it gets more 
interesting if you have installed the laptop-mode package (and it works, 
which isn't the case on my machine), which can (and does) adjust this value. 
The value gets switched to 1 when it's on battery (to save power, which does 
make sense), and gets switched to 255 when it's on power. Note from above 
that 255 DOESN'T ALWAYS WORK, so once it goes to 1, it STAYS at 1. To fix 
this with the laptop-mode package, check /etc/laptop-mode/laptop-mode.conf 
for the settings LM_AC_HD_POWERMGMT and NOLM_AC_HD_POWERMGMT. By default 
(least when I checked) they're 255.

Now the easiest way to change the default boot setting (if you're not using 
laptop-mode) is to use hdparm (the -B option). You used to just add an entry 
to /etc/hdparm.conf and an init.d script applied the settings on boot. 
UNFORTUNATELY, since feisty (afaik) this is now handled by udev, and the udev 
rule (on feisty, that's /etc/udev/rules.d/85-hdparm.rules) limits hdparm to 
running on /dev/hd* by default. Since my drive is now /dev/sda, none of the 
changes in /etc/hdparm.conf did anything, and the man page doesn't mention 
anything about this change, or reference the script that now does the 
work, /lib/udev/hdparm.

Note: I am not sure whether this udev rule is something from upstream or 
otherwise. Either way, it's a pain if you don't know about it!

So I added the following entry to the end 
of /etc/udev/rules.d/85-hdparm.rules:

ACTION=="add", SUBSYSTEM=="block", KERNEL=="sda", \
        RUN+="/lib/udev/hdparm"

And then I added the following to /etc/hdparm.conf:

/dev/sda {
        apm = 254
}

Now at least, my drive gets set to a reasonable setting on boot, and doesn't 
spin down anywhere near as much.


On Thursday 08 November 2007 11:11:03 KENNETH RICHARDS wrote:
> I am wondering if this happens with Desktops as well DC is DC when
> supplied to our drives by our power supplies.

Since this depends entirely on the firmware in the drives, it's quite 
possible. Especially if it's a slimline desktop machine with 2.5" laptop 
drives in it. With newer 3.5" drives, especially with all the emphasis now 
on "power saving" in data centres, it's quite possible that the defaults 
could be in line with the current state of many 2.5" drives.

To check your APM setting:

 sudo hdparm -I /dev/sda|grep "power management"

To set it:

 sudo hdparm -B XXX /dev/sda

(where XXX is a value between 1 and 255. 255 should be disabled, but as 
mentioned above, you may want to try and see if the values change after 
setting.)

To check the load cycles the drive has had:

 sudo smartctl -d ata -a /dev/sda|grep ^193

Good luck.

-- 
 Stuart Young - aka Cefiar - cef at optus.net



More information about the ubuntu-au mailing list