| LWN.net needs you! Without subscribers, LWN would simply not exist. Please consider signing up for a subscription and helping to keep LWN publishing |
Laptop hard disk failures are horrible to contemplate; they always come at the worst possible time, far from home or office, while managing to lose a huge amount of important data. This explains the loud outcry when it appeared that Ubuntu was causing premature failures in laptop hard disks, as was reported in many places last week. The problem is not really Ubuntu-specific, nor as widespread as was feared, but before the dust settled it certainly looked like it might give Ubuntu a very public black eye.
Laptop manufacturers want to reduce the power consumption of their devices; one way to do that is to spin down the hard disk when it hasn't been accessed for a time. Some hard disks then move the heads away from the platters, called "parking the heads", in order to prevent damage to the drive under a sudden deceleration; hitting the floor for example. Depending on the drive, head parking or spinning down will increment a count, the load/unload cycle (or just load cycle) count, which can then be queried using the smartctl command:
[root@anhinga jake]# smartctl -A /dev/sda | grep Load_Cycle
193 Load_Cycle_Count [...] 359618
The number at the end of the line is the count.
Drive manufacturers typically rate their laptop drives for 600,000 load cycles, so when people started noticing counts around half that number on their relatively new Ubuntu laptops, they got worried. Bugs were were filed in Ubuntu's Launchpad, various blogs started reporting it, and the story was picked up by Slashdot, running under the headline "Ubuntu May Be Killing Your Laptop's Hard Drive". At that point, muttering about tar and feathers could be heard in various quarters, but it is difficult to put the blame solely on Ubuntu.
The default power saving settings for a particular laptop are set by the manufacturer. Unless "laptop mode" is enabled – it is off by default, but would seem a reasonable thing to enable on a laptop – Ubuntu does not change those settings. In order to get the best battery life, laptop makers are setting very aggressive power saving modes that will spin down the disk and park the heads after a short period of idle time (typically 15-60 seconds). If the disk is accessed after that happens, the process is reversed and the counter gets incremented again. For some laptops, this happens regardless of whether it is running from battery or not.
Default Ubuntu installs, not unlike many other distributions, tend to access the disk frequently – for logging, atime updates, or other reasons. If the time between accesses is larger than the time between spin downs, a high load cycle count can result. The load cycle count is an indicator of the wear and tear on the drive, for both the motors and the parking mechanism and the drive rating is only an estimate of what can be expected. Users are reporting drive problems with only one-third of the expected load cycles; which may or may not be related, of course.
In some ways, Ubuntu is being victimized by its own success; this problem is getting pinned on Ubuntu, in part, because it is so popular. Users of other distributions are starting to chime in with similar problems. As might be guessed, the problem is not Linux-specific either, with both Mac OS X and Windows laptop users reporting high load cycle counts as well. It is a hard problem to completely get a handle on because it is very hardware-specific, with software settings and usage patterns playing a role as well.
It is hard to claim that any distribution should be changing default power management settings without request by the user – the hardware manufacturers should be responsible for setting reasonable defaults. It will be very difficult for a distribution to know what settings to make, so the laptop vendors need to be held accountable to choose defaults that won't harm the hardware under normal use. It could be argued that a user who enabled laptop mode on Ubuntu made it reasonable for the OS to set the hard disk to its most aggressive power management setting, but that may have worsened the problem for some. Various fixes have been gathered on the Ubuntu wiki page, but the basic idea is to change the power savings setting for the hard disk using hdparm -B 254 /dev/hda (or /dev/sda). The 254 value sets the least aggressive power savings mode; some users are reporting that 255 will disable power management completely, while others say it has no effect.
The biggest change distributions can make to help alleviate this problem is to reduce the number of writes, especially nearly useless writes, to the disk. One of the culprits reported for Ubuntu is the acpid power management daemon writing battery status to a logfile every 15 seconds, which seems like a good way to ensure the battery life reduces more quickly than it should. Some logging could be deferred or disabled when running from battery.
Using the relatime option when mounting filesystems is another, fairly simple, change that could be made to significantly reduce disk writes that are likely to be pointless. Fedora 8 enables that option by default for all systems, battery powered or not, for the disk performance increase that it gives. People running older kernels, before 2.6.20 added the relatime option, may want to consider disabling atime updates altogether using the noatime mount option.
There is still plenty of work to be done to produce the most power efficient Linux systems, but we are making lots of progress. The ongoing work to reduce the power consumption of both the kernel and, more importantly, user space programs, has made amazing strides in a fairly short period of time. This panic over Ubuntu the Mighty Disk Eater might have been overblown, but it will serve to help us get better systems in the long run; yet another step on the path to world domination.
(Note that the Load_Cycle_Count number above in the smartctl example is correct for the author's Fedora 7 laptop with a less than one year old disk. It was increasing at several thousand per day until the hdparm change was made.)
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 9:07 UTC (Thu) by jimparis (guest, #38647) [Link]
For "hdparm -B", 255 is reserved by ATAPI spec, so the behavior could be anything. Anything from 128 to 254 should prevent the drive from spinning down. See Table 43 here.
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 16:47 UTC (Sun) by jengelh (subscriber, #33263) [Link]
It would be a wonderful world if this was the case. The Toshiba MK2003GAH is one of these drives that do parking anyway, even if you -B255 it. Only solution was to write a kernel-level workaround module (I called it thkd) that periodically reads small amounts from the disk.
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 17:29 UTC (Sun) by jimparis (guest, #38647) [Link]
-B255 is reserved, it's no surprise that it still parks the heads.
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 17:31 UTC (Sun) by jimparis (guest, #38647) [Link]
Wait, maybe you meant it also parks with -B128 through -B254, in which case I agree, yes, that sucks. I'm not sure why you need a kernel module though, seems a small user-space utility that does periodic reads with O_DIRECT would work just as well.
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 17:39 UTC (Sun) by jengelh (subscriber, #33263) [Link]
Because the kernel module is smaller (11KB - what, who bloated that up?), does not need glibc, or anything and runs as early as possible without having to mess with the distribution-specific boot scripts. Rebuilding the initrd _with_ your changes is often a real pita.
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 13:25 UTC (Thu) by tialaramex (subscriber, #21167) [Link]
Conspicuous by its absence, so far, is any comment from drive manufacturers. It would be nice to know... Did they know about this before it was widely reported ? Is there any hardware or firmware bug involved ? Do they consider the Load / Unload count to be a significant predictor of early drive failure (most SMART old-age counters aren't very indicative of likely failure) ? Is the behavior (not just seen in Ubuntu) where these cycles occur very frequently actually pathological, or was it considered an acceptable consequence for power saving ? Do they intend to alter the power on configuration of future drives in the light of these results ?
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 13:58 UTC (Sun) by hmh (subscriber, #3838) [Link]
Did they know about this before it was widely reported ?Sure. It is documented (well, if you buy good Hitachi drivers. I don't know about the other HD manufacturers. IMO, most of them are not even worth bothering with, as they don't publish the full HD firmware manual and spec sheet, anyway).
Is there any hardware or firmware bug involved ?You asked the drive to enter the most agressive power management mode. It is doing exactly what you asked it to do. If you don't want it to act like that, don't tell the drive to use the most aggressive power management mode. So, it is not the drive's fault.
Do they consider the Load / Unload count to be a significant predictor of early drive failure (most SMART old-age counters aren't very indicative of likely failure) ?AFAIK, ramp-based head unloads do stress the head assembly in a way that will slowly make it far less reliable, yes.
Is the behavior (not just seen in Ubuntu) where these cycles occur very frequently actually pathological, or was it considered an acceptable consequence for power saving ?How smart it is for a distro or a BIOS vendor to enable the most aggressive power management mode of a drive? Especially when nothing is being done to reduce disk accesses to a level compatible with that power management level?
Do they intend to alter the power on configuration of future drives in the light of these results ?I hope they don't. I'd rather laptop and distro vendors stop enabling it when the entire system is not prepared to deal with it.
It is NOT the user's fault!
Posted Nov 11, 2007 14:44 UTC (Sun) by kevinbsmith (guest, #4778) [Link]
You asked the drive to enter the most agressive power management mode. I did no such thing. I had not touched any hard drive settings in the BIOS or OS until my cycle count was over a million. Linux came pre-installed on this computer, so my role is pure "user". Let's be very clear that the user is the innocent victim here. Any posting that blames the user is quite unfair. The responsibility to avoid this problem may lie with the drive manufacturer, the laptop manufacturer, whoever installed Linux on the laptop, or even with the distro (although that does not appear to be the case). But definitely not with the end-user, who just turned on the laptop and expected it to work. I don't remember any of the online suggestions for mitigating this problem having mentioned checking BIOS settings to see if the power management can be made less aggressive. The article above certainly didn't. I'll try that next time I reboot. Kevin
It is NOT the user's fault!
Posted Nov 11, 2007 14:58 UTC (Sun) by hmh (subscriber, #3838) [Link]
I hate english. Anyway, I wanted to use "you" in the PoV of the HD. I didn't mean "you, the human". I very much doubt any user would want the most aggressive power management mode of the hardware enabled by default. It is annoying, it kills the hardware that much faster, and it introduces a lot of latencies. On the other hand, it is extremely useful when you know what you are doing, and enable it on purpose... This, of course, makes the whole deal of enabling it by default (done by whomever: distro or platform vendor), worse.
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 14:28 UTC (Thu) by kevinbsmith (guest, #4778) [Link]
Thanks for a great article! We really needed some objective, level-headed, fact-based information about this. My 2-year old Ubuntu-from-birth laptop is affected (1.2 million cycles), and the fixes mentioned in the thread didn't help. The linked wiki page is a sad jumble of incomplete suggestions, as of this moment. This article was the first place I have seen that explained that none of the fixes (hdparm) would have any effect unless laptop mode was on. Other posts had led me to believe that I was better off with laptop mode off. I wish it had gone a little farther, though: How can I tell if I am in laptop mode or not? First I had to find the laptop_mode FAQ page (http://www.samwel.tk/laptop_mode/faq), which says "cat /proc/sys/vm/laptop_mode. If it contains a nonzero value, then laptop mode is enabled, if it says 0, then it isn't." Ok, I'm not in laptop mode. How can I turn on laptop mode? It looks like the answer is in "man laptop-mode.conf". Then there are several different suggestions (on that wiki page, in the launchpad thread, and in various blogs) for how to ensure the spin-down settings persist across reboots, and in both AC and Battery mode. How should one decide which method to use? Are some better than others? Can I just change laptop-mode.conf can nothing else? Will all of approaches work on any system? Should I just choose one at random? Are there any distros that are *not* affected? If so, we might learn something from them. Are there any "reasonable" changes that Ubuntu and others should make right away? Should they at least notify users during install that further user action is required to avoid destroying hardware? Finally, how would one enable relatime? Since the lwn article in August, has there been more research into what problems it might cause? This one probably deserves its own follow-up article, since Fedora has decided to set it as the default.
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 16:36 UTC (Thu) by kevinbsmith (guest, #4778) [Link]
(Replying to self) The answer for how to enable laptop mode is not in "man laptop-mode.conf". I fiddled with that, and tried to run /etc/init.d/laptop_mode, and tried to run laptop_mode init. laptop_mode status says "Laptop Mode is NOT allowed to run: /var/run/laptop-mode-enabled does not exist." running sudo laptop_mode gives the unhelpful and contradictory: state: closed yes Laptop mode disabled, active. So even though cat /proc/sys/vm/laptop_mode says I'm in laptop mode (2), my cycle count continues to increase at a rate of one/minute.
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 23:47 UTC (Thu) by jwb (guest, #15467) [Link]
> state: closed > yes > Laptop mode disabled, active. That is hilarious. Laptop mode has always been a questionable hack, at least the one shipped by Ubuntu. At one point Ubuntu was shipping both laptop_mode and laptop_mode_tools, which were contradictory even though their packages didn't claim to conflict. On my PowerBook (where the brilliant firmware cannot be blamed) laptop mode would spin my disk down after *1 second* of inactivity. No joke. Then the disk would spin up again right away. The drain on the battery was tremendous. I had to purge laptop_mode (or was it laptop_mode_tools) and reboot the machine to make it stop doing that.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 10:39 UTC (Tue) by mdz@debian.org (guest, #14112) [Link]
Ubuntu has not shipped laptop-mode, ever. It has never even entered the main repository. Of course, you are welcome to install arbitrary packages from universe and tweak them to suit your needs, but you must also take responsibility for the results.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 15:42 UTC (Tue) by jwb (guest, #15467) [Link]
Ubuntu shipped laptop-mode in the "main" component (aka the official, supported component) in Warty, Hoary, and Breezy. That's three times, not "never" as you say.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 16:02 UTC (Tue) by mdz@debian.org (guest, #14112) [Link]
You're right, I didn't look back that far (over two years now). That laptop-mode is an Ubuntu-specific tool which is long obsolete and will be removed from universe as well. In any case, it was removed from main when laptop-mode-tools was added (in 6.06), so it remains true that Ubuntu did not in fact ship them both.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 10:35 UTC (Tue) by mdz@debian.org (guest, #14112) [Link]
You don't actually want laptop mode enabled unless you've made a great effort to optimize the rest of the system to make it useful (that's why it's disabled by default). Enabling it will just result in the disk spinning up and down a lot, which is what most people investigating this issue want to avoid.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 15:14 UTC (Tue) by kevinbsmith (guest, #4778) [Link]
Actually, my 2-year old laptop had Ubuntu pre-installed. I have never even heard of
laptop-mode until last month, so it was never enabled. And yet my drive has 1.2 million
cycles.
So your post continues to add to my confusion, and offers yet another suggestion ("remove
laptop mode") that won't solve the problem for me.
As for your other post at 10:39:
Of course, you are welcome to install arbitrary packages from
universe and tweak them to suit your needs, but you must also
take responsibility for the results.
More invalid blame of the user. I didn't install what you think I installed, thank you very
much.
1255838 cycles and counting. Still increasing at 5000 per day. Sigh.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 15:21 UTC (Tue) by mdz@debian.org (guest, #14112) [Link]
Don't be silly; reread the comments I was responding to. I addressed two points: 1. That Ubuntu provided two conflicting tools for enabling laptop mode (it hasn't) 2. That enabling laptop mode would be a good way to prevent a high number of load/unload cycles (it isn't) I didn't suggest that you remove the tools for laptop-mode, though I did recommend against enabling it. If you want to set default power management settings for your disk in Ubuntu, /etc/hdparm.conf is probably the best way to go about it.
Laptops, power management, and Ubuntu
Posted Nov 13, 2007 17:15 UTC (Tue) by kevinbsmith (guest, #4778) [Link]
I apologize for misunderstanding which of the two laptop modes you were talking about. Still,
it's clear that neither is causing my problems. And other folks have suggested that enabling
laptop mode (with appropriate settings) is a way to solve the problem. (Some folks say the
hdparm -B setting is ignored if you are not in laptop mode).
I appreciate the pointer to /etc/hdparm.conf. It's not mentioned on Ubuntu's wiki page, and I
don't remember seeing it anywhere else. I just added this to mine:
/dev/sda {
apm = 254
spindown_time = 240
}
Unfortunately, I can't find any way to confirm that I added it correctly. I have no idea
whether those commands are in effect or not. I rebooted.
But my cycle count continues to increase by 4/minute, so it hasn't solved my problem.
I also checked my BIOS, and there are no settings there to control how the hard drive behaves.
And I re-ran hdparm directly (-B 254 and -S 240), and my cycle count continues to increase at
the same rate.
Laptops, power management, and Ubuntu
Posted Nov 23, 2007 19:52 UTC (Fri) by kevinbsmith (guest, #4778) [Link]
Quick update, in case it helps someone else. It seems that my Samsung drive ignores hdparm settings unless you first do: sudo smartctl -o on /dev/sda Don't ask me why. It makes no sense. But it worked. My load cycle count has finally stopped increasing. At this point, my drive seems to be ignoring the hdparm -B parameters (stuck at 128 according to hdparm -I), but seems to be paying attention to -S (not fully confirmed). When I suspended for 10 minutes, my load cycle went up by exactly one, which is a good sign. Here is my forum post (basically what I just said here): http://ubuntuforums.org/showpost.php?p=3825166&postco... At this point, I suspect that if I can get my system to stop accessing the drives every few seconds, the heads will park when idle, as they should. Next quest: Find a good guide to how to configure relatime. Why is that so hard to find?
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 16:58 UTC (Thu) by tialaramex (subscriber, #21167) [Link]
You haven't understood the article at all. You need not be using laptop mode to see high load / unload count. Without laptop mode your disk uses the manufacturer's power on setttings, and if those include aggressive APM then you may see an increasing count in this SMART old age parameter as a result. Ubuntu (and everyone else) are just pointing out that unless you enable laptop mode their software isn't touching these settings at all, and therefore any responsibility for the settings must lie with the disk manufacturer. As to whether you're "better off" with or without laptop mode, that depends what you want to achieve. If one or the other option was just "better" then obviously it would always be set that way. If your hard disk dies within the warranty period, demand a replacement. If it doesn't, what are you worrying about? And meanwhile remember to take regular backups. All good advice without the hysteria about a SMART parameter that's not intended for end users to look at.
Laptops, power management, and Ubuntu
Posted Nov 8, 2007 19:29 UTC (Thu) by kevinbsmith (guest, #4778) [Link]
Unforunately, this is the kind of user-hostile response that is common in the other blog posts and threads. Paraphrasing: "Your hard drive might die. Tough. Not our fault." I'm about a year or two out of warranty. If my drive dies for preventable reasons, I will still be disappointed and annoyed. Should I not be "worried" about the expense, downtime, and possible loss of even a few hours of work? The point isn't to find blame. The point is to a) figure out what *I* can do to save my drive (or at this point maybe what I can do to save the replacement drive I'll have to buy), and then b) figure out what distros could do to let other folks know that they need to do something to save their drives, and then c) figure out if there is something distros can do to avoid the problem (even though the root cause may be the drive and/or BIOS settings). I have read that MS Windows overrides the disk and/or BIOS settings to avoid, or at least minimize this problem. From a technical purist standpoint, It may be annoying to have to do this, but sometimes such impurities are the least-bad option. Real people are going to have to spend real money replacing real hardware. Let's try to minimize that cost (and landfill usage), shall we?
Laptops, power management, and Ubuntu
Posted Nov 9, 2007 16:08 UTC (Fri) by gnu_lorien (subscriber, #44036) [Link]
I've never read these comments as user-hostile. The distro saying we won't touch these settings isn't telling you they don't care, it's saying that it doesn't seem like something we should do. Maybe if they find the magic number that everybody loves this won't be a problem. Right now they have the people with dying laptop hard drives screaming at them. If they tweak the number, maybe it will silence those people but anger some other user? Maybe the number they pick will be wrong and instantly kill the hard drive? The right answer isn't clear, which is why they're falling back on, "We won't touch it unless you explicitly tell it to."
Laptops, power management, and Ubuntu
Posted Nov 9, 2007 18:19 UTC (Fri) by kevinbsmith (guest, #4778) [Link]
Let's look at the two issues seperately. As far as I can tell, none of the distros have offered any official advice about how to deal with this problem. That is a "we don't care" attitude. If the distros won't help, who will? The minimum I would find acceptable is to advise users that there may be a problem, and suggest possible things the user can do to mitigate. If you can point me to anything like that, please do. I have not yet found any official (or unofficial) step-by-step instructions for things to try. Vague advice like "use hdparm" or "turn on laptop mode" don't count. It would be even better if they could find a way to "fix" it in software. The comment posted above was, in my opinion, hostile to users. Notably: "If your hard disk dies within the warranty period, demand a replacement. If it doesn't, what are you worrying about?" Other forum posts elsewhere have been even worse. There *is* a problem. We as a community *need* to find a solution. As I said, that might just be providing step-by-step instructions so each user can manually tweak their machine to their own preferences. And letting folks know they need to do that to avoid losing their drives. We don't even have that yet.
Laptops, power management, and Ubuntu
Posted Nov 9, 2007 19:17 UTC (Fri) by gnu_lorien (subscriber, #44036) [Link]
While we may disagree on the "user-hostility" idea, I think you're definitely right that people need to be informed about potential problems like this no matter whose fault it really is. Actually, I would say that's a general problem. As a community we have lots of resources to find out about the problems and do our own sifting for solutions, but it seems like this process is sometimes unnecessary. In this case for this bug, there's actually a metric for when the distro can guess that something is going wrong (e.g., check every hour to see if the spin count is increasing at an inappropriately high rate). Unfortunately, there aren't that many tools to get this sort of information, at least not for a desktop distribution. I think it would be interesting to see an interface along the lines of Fedora's SELinux Troubleshooter for things like this. Maybe every hour a cron job starts up to check for common errors with metrics like this. If there is one, an icon displays in the task bar to tell you about it and point you towards some proposed fixes with all the requisite warnings about changing your hardware defaults?
Laptops, power management, and Ubuntu
Posted Nov 9, 2007 12:46 UTC (Fri) by canatella (subscriber, #6745) [Link]
Maybe the 1.2 million cycles are due to a previous installation, or maybe it's a bug in your smart implementation (I've read about that somewhere). Anyway, the number which is important to you today is the number of cycle per day or per hour. If the head parks 1000 times a day, the drive will reach the 600000 cycles in two years. So if you hope to have your disk last at least 3 years, check that your cycle number per day is less than 600000/(365 * 3) => 547.
Laptops, power management, and Ubuntu
Posted Nov 9, 2007 18:24 UTC (Fri) by kevinbsmith (guest, #4778) [Link]
Yesterday I was just below 1235000, and today I'm at 1239893, so the number is still increasing very quickly. Several cycles per minute that the computer is turned on.
Laptops, power management, and Ubuntu
Posted Nov 11, 2007 13:23 UTC (Sun) by hein.zelle (guest, #33324) [Link]
I'm a bit surprised by remarks like "if you hope to keep your drive for 3 years". I'm used to ide drives lasting 10 years and up in desktops. I would _at the very least_ expect a drive to last for the common lifetime of a computer. These days i use a linux machine at least 3, usually 4-5 years before performance drops too far behind. Anything less is not an acceptable "expected lifetime", to me.
related - disk failure rates
Posted Nov 8, 2007 20:09 UTC (Thu) by grouch (guest, #27289) [Link]
An earlier article on LWN that may be of interest to anyone experiencing failures on laptops: KHB: Real-world disk failure rates: surprises, surprises, and more surprises, by Valerie Henson. "SMART errors do mean the drive is more likely to fail, but a third of drives die with no warning at all!"
Laptops, power management, and Ubuntu
Posted Nov 10, 2007 19:16 UTC (Sat) by mdz (guest, #6621) [Link]
The count on my two-month-old Thinkpad t60p is 600k+. I am concerned.
Laptops, power management, and Ubuntu
Posted Nov 10, 2007 23:00 UTC (Sat) by gerv (subscriber, #3376) [Link]
My count on my Thinkpad X40 is 5662176519809 (sic). Given that the machine is around 3 years old, if we assume it's been on all that time (which it hasn't) that indicates a head park about 60,000 times a second. I knew these new hard disks were fast and the power-saving was aggressive, but... Seriously, anyone know why smartctl -A /dev/sda might give such an amazingly large figure? I've just seen it increase by 16 million in 19 seconds, so something is rather wrong. Gerv
Laptops, power management, and Ubuntu
Posted Nov 16, 2007 0:05 UTC (Fri) by emj (guest, #14307) [Link]
I have a X40 which just begun it's fourth year of usage and has been in heavy use. It has a value of 4.6*10^9[1] which is about 10^9 less than you. Though smartctl says it has been powered on for 47 years.. [1] 4654956297329
Laptops, power management, and Ubuntu
Posted Nov 12, 2007 11:11 UTC (Mon) by sitaram (guest, #5959) [Link]
For all the mandriva users out there, here's what seems to work for me (this is a Dell
something with a Hitachi 60 GB hard disk). Note that I don't see why some eqvt of this won't
work for others too...
(1) make the following changes in /etc/laptop-mode/laptop-mode.conf.
# Idle timeout values. (hdparm -S)
# Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 20 seconds
# for battery and for AC with laptop mode on.
# Anything more than 10-15 minutes (900 seconds) ought to be OK, actually...
LM_AC_HD_IDLE_TIMEOUT_SECONDS=5400
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=3600
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
# Should laptop mode tools control the hard drive power management settings?
CONTROL_HD_POWERMGMT=1 # this has to be 1 else nothing happens, I believe
# Power management for HD (hdparm -B values)
BATT_HD_POWERMGMT=254 # 255 didn't work for me.
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254
Notes on above:
I have found that controlling only "-B" is not enough. As the original article said, in some
cases spindown also counts as a load/unload, so you need to fix "-S" also.
(2) in file /usr/share/pm-utils/sleep.d/92disk, added a line inside the function
"resume_disk":
/sbin/hdparm -B 254 -S 241 /dev/sda
Notes on above:
(i) the code in the said file does not recognise SATA disks and I do not have the energy/time
(read: SMARTs, no pun intended!) to figure out how to make that happen, hence the hardcoding.
Please change the /dev/sda to whatever you have
(ii) if your hard disk is IDE, setting
RESUME_DISK="-B 254 -S 241"
ought to be enough for you, but I have no way of testing that
(iii) why do I need to do this at all? Glad you asked... ;-)
The reason is that the laptopmode hooks seem to kick in only when switching from battery to AC
or vice-versa. When coming up from a suspend (whether to disk or to RAM), when there has been
NO change the AC/battery status, they DONT kick in, and you are left with the hard disk
default. Which is what caused the problem in the first place!
This file (the /usr/share/pm-utils/sleep.d/92disk thing) *does* get called on a resume, so I
use that.
By the way this file is from the "pm-utils" package.
Laptops, power management, and Ubuntu
Posted Nov 15, 2007 9:01 UTC (Thu) by callegar (guest, #16148) [Link]
The question should probably be not who is to blame for it, rather what is the behaviour that actually needs fixing. Most articles on this topic seem to suggest that the issues is hard disk spinning down to early (after a few tens seconds of inactivity), because the silly bios instructs them to do so and the OS does nothing to change this default. Under this analysis the behaviour that needs fixing is the hard disk power management level. But a few voices tend to disagree. Maybe there is nothing wrong in hard disks spinning down and parking early. Maybe the hard disk and bios defaults are perfectly right in the vision of a manufacturer that expects an OS not doing all that logging, all that writing down access times, and the like. Maybe, the problem is actually that the hard disk gets re-spinned up too early even in complete absence of user activity. Under this second analysis the behaviour that needs fixing is the OS way of causing continuous hard disk writes, and not necessarily the hard disk power management level. It is to notice that this second analysis, in spite of being minority, is supported by the fact that if one actually wants to get decent battery life it is not the active-to-parked time to be enlarged, but the number of activations to be reduced. In my opinion, the first analysis is majority just because the problem it outlines is easier to patch. The second analysis actually says that the real issue is that the OS is not enough aware of what a laptop is and of how to coordinate efforts to do power management. Namely, it is silly to tell the hard disk to be aggressive, if the logging system does not defer logs, etc. If this is the case, a subsystem a la "laptop_mode", but enhanced is the real solution. When a laptop is on battery _all_ the unnecessary hard disk activity should be very much deferred and aggregated. This should include inner OS disk activity, logging, and applications (window manager, GUI, etc). And this is something that is only partially possible to do now, because logging daemons and applications cannot be easily switched between two different operating modes. Maybe, an OS that is truly ready for laptops should need one more signal than it has now. There might be a signal to tell all processes that the system is changing power mode, so that each change of status can be communicated to all processes. Legacy programs should just ignore this signals. Laptop-aware programs should consider the change of status, read the new status and cooperate with it. BTW, this could be useful also to make applications aware of when a system is going to suspend and take consequent actions (e.g. we might want a SIP client to de-register before suspension and to re-register right after wake-up). And one more thing: to do control proficiently, observing the achieved behaviour is often a smart thing. Since hard disks have "power levels" that are just "abstract", there should be tools to keep accounting of spin-down and spin-up average times (either to be invoked one shot, to determine best parameters for system and average use, or to be periodically in operation). This could also be used to alert the user if potentially dangerous hard-disk behaviours should appear.
Don't confuse head parking with spindown!
Posted Nov 17, 2007 11:22 UTC (Sat) by anton (subscriber, #25547) [Link]
The article and many comments confuse head parking with spindown:BTW, given that the hard drive manufacturers fail to provide a standard interface to control head parking (and the APM feature (hdparm -B) does not help on some drives), I don't see how anybody but the hard drive manufacturers can be blamed for parking the head too often. E.g., my WDC WD400UE-22HCT0 parked the heads every 30s without caring for disk activity (the spindown timeout is smarter); fortunately, hdparm -B 254 helped.
Don't confuse head parking with spindown!
Posted Dec 16, 2007 12:45 UTC (Sun) by PaulD (guest, #49571) [Link]
Hello everyone, This is my first post here. I just wanted to put in my "two cents worth". Firstly, thanks for all your advice and information. I appreciate it and I have been experienced similar "problems" on my ageing but reliable Toshiba Satellite M-30 whilst running Ubuntu. I can't understand until this is sorted out why you guys want to risk your hardware? It's just not worth it... unless you have heaps of money to burn that is... In my mind it's not worth even discussing it until these bugs are worked out. I'm not gonna be anyone's guinea pig thanks. I just wanted to relay my thoughts... A. I'm not pointing the finger but in the case of Ubuntu, the current revision is 7.010 right? This problem has been happening for ages so why is it not sorted out by now? Sure the OS has (apparently) +made many advances BUT why not get the mechanics right FIRST instead of concentrating on giving us a pretty GUI? All we have are tons of dubious suggestions, hacks, vague technical explanations, and lets face it "guesses" as to how to fix this problem which have frankly left me extremely frustrated and which I do not understand because the hype promised me that I didn't have to be technically minded to operate Ubuntu. I also don't undertand why some people continue to point the finger at hardware manufacturers? You see, a sticker on my laptop clearly reads "designed for Windows XP". It doesn't say "designed for Linux". Despite being almost three years ago this old laptop can do anything I throw it and runs XP just as well as any of the new laptops my frends have. It's been my main computer, not just a laptop, for all this time, switched on night and day most of the time 24-hours and I cannot break it so why should I want to let Linux break it for me? Despite this I listened to the hype and recently excitedly installed Ubuntu (dual boot with XP). From the start I got immediately suspicious of this crazy overzealous hard-drive activity. All of my Toshiba Power saving stuff was turned off. Made no difference whatsoever. I searched the forums for weeks. I looked for Linux utilities to help. I thought logically someone might have written a reliable utility to fix this or at least help. Nope, apparently not. The net effect: I'm not prepared to risk my hardware (yes it's old - I can't afford to buy a new one at the moment) until the OS is working properly). And why should I, it's a fantastic machine. Ubuntu comes with a power-saving utility but why on earth does it not include a sliding-scale option to change CPU power (up or down)like the Toshiba Power Saver does. This shouldn't be too hard. This opens up another issue. Over heating. You see the hotter your CPU runs the more your laptop is gonna heat up. I run my laptop at 70% with not a single problem in all these years. Who the heck cares if I have to wait two milliseconds more here and there if Im' gonna potentially get another year or two of life outta my machine! It's still damned fast. With Ubuntu it heats up significantly more than under XP. So... run the CPU slower, keep everything cool. thats the key. BUT I still cant find a decent, reliable Linux utility to do this for me either. Im not willing to destroy my CPU or my hard disk on the basis of any OS that is very immature (despite the hype) and doesn't have manufacturer support and also does not have it where it counts. Core functionality and reliability is the key. This is where XP win hands down. Also I thought users didn't have to be technically inclined to use Ubunutu? Every forum I've seen everything suggestions entail going straight to the commands like an entering cryptic commands and switches. Uggghhh... Users like me don't understand this jargon (but again according to the hype we don't need to!) and it only pushes us away from using Ubuntu. Stick with XP, it's still a million miles in front. Yes, you have to pay for it, yes it has issues, but at the end of the day, it works. It's polished. It's professional (more than Linux OS's anyway) and it won't destroy your hardware. One day when someone works out the bugs I will look towards with great anticipation to trying a Linux disto again but not for a while. For now, I'm sticking with XP because I trust it.
Copyright © 2007, Eklektix, Inc.
This article may be redistributed under the terms of the
Creative
Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds