Re: [gentoo-user] HDD with too aggressive power management
On 22:08 Tue 01 Feb , Nils Holland wrote: I guess it's probably the way this machine works, and feel that the reference to acpid sounds like a very promising way to fixing this. As such, thanks to everyone who pointed me into that direction - I'll have a look and see if it works! Replying to myself here, but wanted to give everybody who pointed my in the acpid direction yesterday some feedback: I emerged acpid yesterday, had a look at your examples, studied the man page a bit and set it up. And well, I've explicitly switched between wall power and battery power more often than I would normally do, with the result that I can now say that the suggested solution works really well! Thanks again and greetings, Nils -- Nils Holland * Ti Systems, Wunsorf-Luthe (Germany) Powered by GNU/Linux since 1998
Re: [gentoo-user] HDD with too aggressive power management
On 08:38 Tue 01 Feb , Iain Buchanan wrote: Hi, On Mon, 2011-01-31 at 22:09 +0100, Nils Holland wrote: However, now comes the problem: It seems that whenever I change from wall power to battery power (probably also vice versa, but I haven't tested this often enough), the machine's HDD forgets about the settings I've made using hdparm and starts spinning down right again after only a few seconds of inactivity. That sucks. frustrating indeed! It could be a number of things: gnome, acpi, and/or bios making the changes automatically. My preference would be to fix it in acpid since it will work independent of the window manager or even X. emerge acpid, then edit /etc/acpi/default.sh similarly (sorry about the tabs/spaces): [...] Hi Iain and everyone who replied, thanks for all of your suggestions! In fact, I've noticed that GNOME and other desktop environments seem to contain grephical interfaces for setting the HDD to spin down automatically and already suspected such a piece of software unwantedly being responsible for the behavior I'm seeing. But I guess I can actually rule that out: I'm not using any such desktop environment, but am actually using only the awesome wm as my window manager. Furthermore, I don't use an X Display manager but boot up in console-only mode and start X only when needed via startx. Therefore, I can rule out GNOME, KDE, etc. being responsible, and as for the rest of the stuff I've installed, I've choosen it rather carefully and certainly didn't installing anything power-management-like. I guess it's probably the way this machine works, and feel that the reference to acpid sounds like a very promising way to fixing this. As such, thanks to everyone who pointed me into that direction - I'll have a look and see if it works! Greetings and thanks again, Nils -- Nils Holland * Ti Systems, Wunsorf-Luthe (Germany) Powered by GNU/Linux since 1998
[gentoo-user] HDD with too aggressive power management
Hi folks, I've got an Asus X7BJ-something laptop here that by default (i.e. when installing plain Gentoo on it) seems to do too aggressive power management for its hard drive. That is, already after only about five seconds(!!) of inactivity, the HDD spins down. This is kind of insane - you edit some small file, only half a minute later when you save it, you have to wait for what feels like ages for your HDD to spin back up and actually do something. ;-) The first thing I tried was having a look at the BIOS to see if HDD power management can be disable there. But no sir, no such option. Ok, no problem I thought, and emerged hdparm, which I have added to my default runlevel, so that it gets executed with the arguments -B 254 -S 0 upon each boot. That seems to fix it, HDD power management is off and no more unwanted spindowns occur. However, now comes the problem: It seems that whenever I change from wall power to battery power (probably also vice versa, but I haven't tested this often enough), the machine's HDD forgets about the settings I've made using hdparm and starts spinning down right again after only a few seconds of inactivity. That sucks. Of course, manually executing hdparm -B 254 -S 0 /dev/sda after unplugging the machine fixes the issue again. However, something more automated would be prefered. First thing, I'm wondering if the change in power management parameters is actually caused by something at the OS level. I haven't set up any such thing explicitly, so I believe that it's something the machine just does outside of the OS's control. As it can be overridden by executing hdparm manually, what I would need is probably a place where I can hook in with a little shell script that gets executed every time the system's power source changes, and does nothing else than just execute hdparm with the appripriate parameters. So much about the theory, but then I don't really have an idea what I'd have to do to get a script to run every time the power source changes. And that's why I'm writing this message, as any suggestions that could point me into the right direction are very welcome. ;-) Greetings and thanks in advance, Nils -- Nils Holland * Ti Systems, Wunsorf-Luthe (Germany) Powered by GNU/Linux since 1998
Re: [gentoo-user] HDD with too aggressive power management
On Mon, Jan 31, 2011 at 3:09 PM, Nils Holland n...@tisys.org wrote: Of course, manually executing hdparm -B 254 -S 0 /dev/sda after unplugging the machine fixes the issue again. However, something more automated would be prefered. I had the same problem. My solution was to edit /etc/conf.d/local and add the command into the local_start() function (before the return): local_start() { # This is a good place to load any misc programs # on startup (use /dev/null to hide output) hdparm -B 254 /dev/sd[abcdef] # We should always return 0 return 0 } and it automatically fixes my drives when I reboot.
Re: [gentoo-user] HDD with too aggressive power management
Apparently, though unproven, at 23:09 on Monday 31 January 2011, Nils Holland did opine thusly: Hi folks, I've got an Asus X7BJ-something laptop here that by default (i.e. when installing plain Gentoo on it) seems to do too aggressive power management for its hard drive. That is, already after only about five seconds(!!) of inactivity, the HDD spins down. This is kind of insane - you edit some small file, only half a minute later when you save it, you have to wait for what feels like ages for your HDD to spin back up and actually do something. ;-) The first thing I tried was having a look at the BIOS to see if HDD power management can be disable there. But no sir, no such option. Ok, no problem I thought, and emerged hdparm, which I have added to my default runlevel, so that it gets executed with the arguments -B 254 -S 0 upon each boot. That seems to fix it, HDD power management is off and no more unwanted spindowns occur. However, now comes the problem: It seems that whenever I change from wall power to battery power (probably also vice versa, but I haven't tested this often enough), the machine's HDD forgets about the settings I've made using hdparm and starts spinning down right again after only a few seconds of inactivity. That sucks. Running KDE with PowerDevil perhaps? Of course, manually executing hdparm -B 254 -S 0 /dev/sda after unplugging the machine fixes the issue again. However, something more automated would be prefered. First thing, I'm wondering if the change in power management parameters is actually caused by something at the OS level. I haven't set up any such thing explicitly, so I believe that it's something the machine just does outside of the OS's control. As it can be overridden by executing hdparm manually, what I would need is probably a place where I can hook in with a little shell script that gets executed every time the system's power source changes, and does nothing else than just execute hdparm with the appripriate parameters. So much about the theory, but then I don't really have an idea what I'd have to do to get a script to run every time the power source changes. And that's why I'm writing this message, as any suggestions that could point me into the right direction are very welcome. ;-) Greetings and thanks in advance, Nils -- alan dot mckinnon at gmail dot com
Re: [gentoo-user] HDD with too aggressive power management
Hi, On Mon, 2011-01-31 at 22:09 +0100, Nils Holland wrote: However, now comes the problem: It seems that whenever I change from wall power to battery power (probably also vice versa, but I haven't tested this often enough), the machine's HDD forgets about the settings I've made using hdparm and starts spinning down right again after only a few seconds of inactivity. That sucks. frustrating indeed! It could be a number of things: gnome, acpi, and/or bios making the changes automatically. My preference would be to fix it in acpid since it will work independent of the window manager or even X. emerge acpid, then edit /etc/acpi/default.sh similarly (sorry about the tabs/spaces): ... ac_adapter) case $value in *0) # code for unplugging the power echo conservative /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo conservative /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor ;; *1) # code for plugging in the power echo performance /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo performance /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor ;; ... Change (or add) your hdparm commands as required. You could have a different spin-down setting for power and battery if you wish. You'll still have to change the setting after booting, since acpi events usually aren't triggered then. Use local_start() as Paul suggested. If you suspend you may even have to do it after resuming as well. Note that if you use different spin down times you'll need to detect the state of AC before running the hdparm command. Something like this in /usr/local/bin/ should do: #!/bin/sh if ( awk '{print $2}' /proc/acpi/ac_adapter/AC/state | grep on-line ); then # AC adaptor is on-line! echo performance /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo performance /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor else # AC adaptor is off-line! echo conservative /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo conservative /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor fi then call that script from local_start(). HTH! -- Iain Buchanan iaindb at netspace dot net dot au I can write better than anybody who can write faster, and I can write faster than anybody who can write better. -- A.J. Liebling