红联Linux门户
Linux帮助

Aggressive Power Management in Linux Distros

发布时间:2007-11-24 11:42:11来源:红联作者:Nesoikps
So imagine my surprise when I finished the article, in which the main goal was to make me tired
enough to sleep so I wouldn’t be completely useless at work the next day, and posted it that the
digs started coming in almost immediately. I saw that I had 8 before I went to bed, and didn’t
think anything about it until the next night, when I checked and saw over 400. Insanity. At any rate,
to make it short, let me say Thank You to all of you (even the trolls!) if for nothing else participating
in a lively discussion. Enough mushy community group hug crap. Let’s get down to work.

Of all the responses that were posted in response to my first article, this one was far and away the
most relevant. (Especially when you consider the fact that after some research I realized the guy
was a lead Ubuntu developer!)

“The situation is somewhat less clear than you might think from the article, but the basic takeaway
message is that Ubuntu doesn't touch your hard drive power management settings by default. In
almost all cases, it's more likely to be your BIOS or the firmware on your hard drive.

The script that's executed when you plug or unplug your laptop is /etc/acpi/power.sh. The relevant
sections are:

function laptop_mode_enable {
...
$HDPARM -S $SPINDOWN_TIME /dev/$drive 2>/dev/null
$HDPARM -B 1 /dev/$drive 2>/dev/null
}

That is, when the laptop_mode_enable function is called, we set the drive power parameters. Now,
by default laptop_mode_enable isn't called:

if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
(sleep 5 && laptop_mode_enable)&
fi

because ENABLE_LAPTOP_MODE is false in the default install (check /etc/default/acpi-support). This
means that, by default, we do not alter the hard drive power settings. In other words, the APM
settings that your drive is using in Ubuntu are the ones that your BIOS programmed into it when the
computer started. This is supported by the fact that people see this issue after resuming from
suspend. We don't touch the hard drive settings at that point, so the only way it can occur is if your
BIOS or drive default to this behaviour.

If you enable laptop mode, then we will enable aggressive power management on the drive and
that may lead to some reduction in hard drive lifespan. That's a fairly inevitable consequence of
laptop mode, since it only makes sense if the laptop enages in aggressive power management. But,
as I said, that's not the default behaviour of Ubuntu.

There's certainly an argument that we should work around BIOSes, but in general our assumption
has been that your hardware manufacturer has a better idea what your computer is capable of than
we do. If a laptop manufacturer configures your drive to save power at the cost of life expectancy,
then that's probably something you should ask your laptop manufacturer about”

So let me put this out there in capital letters, because I NEVER wanted any semblance of bad
publicity for Ubuntu. UBUNTU DOES NOT OVERWORK YOUR HARD DRIVE UNLESS IT IS IN LAPTOP
MODE.
……


And below is the solution:

Edit /etc/hdparm.conf and add:

/dev/sda {
apm = 255
spindown_time = 0
}

As suggested to my by Kirrus, some machines will require 244 rather than 255.

Install hdparm init script:

sudo update-rc.d hdparm defaults
文章评论

共有 0 条评论