Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] HDD with too aggressive power management
Date: Mon, 31 Jan 2011 23:06:16
Message-Id: 201102010016.40309.alan.mckinnon@gmail.com
In Reply to: [gentoo-user] HDD with too aggressive power management by Nils Holland
1 Apparently, though unproven, at 23:09 on Monday 31 January 2011, Nils Holland
2 did opine thusly:
3
4 > Hi folks,
5 >
6 > I've got an Asus X7BJ-something laptop here that by default (i.e. when
7 > installing plain Gentoo on it) seems to do too aggressive power
8 > management for its hard drive. That is, already after only about five
9 > seconds(!!) of inactivity, the HDD spins down. This is kind of insane
10 > - you edit some small file, only half a minute later when you save it,
11 > you have to wait for what feels like ages for your HDD to spin back up
12 > and actually do something. ;-)
13 >
14 > The first thing I tried was having a look at the BIOS to see if HDD
15 > power management can be disable there. But no sir, no such option. Ok,
16 > no problem I thought, and emerged "hdparm", which I have added to my
17 > default runlevel, so that it gets executed with the arguments "-B 254
18 > -S 0" upon each boot. That seems to fix it, HDD power management is
19 > off and no more unwanted spindowns occur.
20 >
21 > However, now comes the problem: It seems that whenever I change from
22 > wall power to battery power (probably also vice versa, but I haven't
23 > tested this often enough), the machine's HDD forgets about the
24 > settings I've made using "hdparm" and starts spinning down right again
25 > after only a few seconds of inactivity. That sucks.
26
27 Running KDE with PowerDevil perhaps?
28
29
30
31
32
33
34 >
35 > Of course, manually executing "hdparm -B 254 -S 0 /dev/sda" after
36 > unplugging the machine fixes the issue again. However, something more
37 > "automated" would be prefered.
38 >
39 > First thing, I'm wondering if the change in power management
40 > parameters is actually caused by something at the OS level. I haven't
41 > set up any such thing explicitly, so I believe that it's something the
42 > machine just "does" outside of the OS's control. As it can be
43 > overridden by executing "hdparm" manually, what I would need is probably
44 > a place where I can hook in with a little shell script that gets
45 > executed every time the system's power source changes, and does
46 > nothing else than just execute "hdparm" with the appripriate
47 > parameters. So much about the theory, but then I don't really have an
48 > idea what I'd have to do to get a script to run every time the power
49 > source changes. And that's why I'm writing this message, as any
50 > suggestions that could point me into the right direction are very
51 > welcome. ;-)
52 >
53 > Greetings and thanks in advance,
54 > Nils
55
56 --
57 alan dot mckinnon at gmail dot com