Power Saving in Ubuntu for the Dell M1330
Recently I was feeling sort of green, but mainly annoyed from having to plug my laptop in all the time when its juice starts running low. So I thought I’d set about increasing the battery life. My previous experience was mainly to run powertop (a handy Linux app that will advise you on improvements to make). Here’s a little more on the subject and a few things I came across.
Ubuntu (in my opinion) still isn’t as good as Windows when it comes to power management, especially for laptops. (Update 09/09/2009 – after a little time trial (and by no means accurate), Windows 7 lasted 2h 15mins on my latop and Linux 1h 45mins).
It’s either quite dangerous… there is a hard drive load cycle bug which some people have claimed has been fixed, but there is still proof that it hasn’t. Here’s a post detailing how to see if you’re affected.
Or it just doesn’t work, in terms of hibernating and suspending a machine. This applies to both laptops and desktops. On some machines, it works fine on, on others… black screens, load errors etc… Thankfully on my Dell XPS M1330 though this isn’t the case, although I do have problems with the hard drive load cycle bug.
My first step was to follow this HowTo
http://ubuntuforums.org/showthread.php?t=847773 from Post #1.
I did however find the line:
hdparm -B 1 -S 4 -M 128 /dev/sda
was causing my hard drive to spin down/up quite a bit. It would spin down, then within 10 seconds would spin back up again. This would go on and on which wears out the drive, uses up more power and generally shouldn’t be necessary. Windows 7 by comparison doesn’t seem to have this issue.
Changing it to a less aggressive setting, “hdparm -B 254 -S 24 -M 128 /dev/sda” hasn’t solved the problem directly (my hard drive is on all the time now), but I at least don’t get the constant load cycles.
One problem I found was that I mostly use Firefox when on my laptop. Firefox uses a database (SqlLite) to store browsing history and other information. SqlLite isn’t included as part of Linux’s disk write management, so it constantly “dirties” the cache and causes the drive to spin up for a write back. Using the less aggressive spin up/down setting above helped solved this a little (as my hard drive requires a longer inactive period before spinning down).
I did consider switching browser, but found Opera (a great little browser, but lacks the extensions of Firefox) acted in exactly the same way, as in retrospect I think it too uses SqlLite (or similar). I didn’t try any other browsers.
A couple of tools worth using when looking at improving power management are iotop and powertop.
sudo apt-get install iotop powertop
iotop is especially helpful when keeping an eye on what is accessing the hard drive. Use the following command for each application help find out what is using up power:
sudo iotop -o;
sudo powertop -t 60 -d;
You’ll probably notice “kjournald” and “gconf-2″ causing a fair amount of IO with iotop. Also Firefox (if you have it open), and GnomeDo (if you’re using it). I’ve also noticed the WebCam and Biometric Reader are on 100% of the time but not yet figured out how to turn them off.
My power usage according to powertop is usually around 16-18W an hour. So not too bad. I’ve read of people getting it as low as 12-13W. I’m quite happy to have mine a little higher though due to the way I use my laptop.
If you’ve got any suggestions for improvements, please post them.