Laptop-Mode

Because I have to do this very often, I write down the steps to configure laptop_mode the way I want here.
This also replaces the former (and unfortunately lost) entry for letting my servers hard disks spin down. Note that many of the laptop_mode features even work on non ACPI-aware computers (like my server) but you have to start it manually.

Edit laptop-mode configuration

On Ubuntu 7.04, the configuration file for laptop-mode is
/etc/laptop-mode/laptop-mode.conf

  • Enable Laptop mode on both, battery and AC.
ENABLE_LAPTOP_MODE_ON_BATTERY=1
ENABLE_LAPTOP_MODE_ON_AC=1
  • This values control how many seconds unwritten changes are kept in memory.
LM_BATT_MAX_LOST_WORK_SECONDS=900
LM_AC_MAX_LOST_WORK_SECONDS=600
  • Set the spindown timeout values to a time that is fair for your hard disk. Note that laptop disks survive much more spin up-/down cycles than 3.5” disks before they fail. A 2.5” hard disk is typically rated to have about 300,000 spin ups, a 3.5” hard disk has only about 50,000 times.
CONTROL_HD_IDLE_TIMEOUT=1
LM_AC_HD_IDLE_TIMEOUT_SECONDS=600
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=20
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
  • Sometimes you are a perfectionist, then you can enable the noatime mount option, then the file access time is not written to the disk when you just read a file.
CONTROL_NOATIME=1

Syslog

  • Syslog can thwart your power saving plans when the log daemon writes the log file to the disk every time. The following command configures laptop mode to take care of how log file writing is done.
sudo /usr/sbin/lm-syslog-setup

Enable Laptop Mode

Is it running?

When the file contains a non-zero value, laptop mode is currently running.

cat /proc/sys/vm/laptop_mode

Start Laptop Mode

This starts laptop-mode right now but it will still consider ENABLE_LAPTOP_MODE_ON_BATTERY and ENABLE_LAPTOP_MODE_ON_AC from the config file.

sudo laptop_mode start
# or
sudo /etc/init.d/laptop-mode restart

If you have the problem that laptop-mode runs when you execute laptop_mode start, but it is not running after startup, then you should check the point below:

Enable Laptop Mode

This enables Laptop Mode on your Ubuntu 7.04 machine. The next time a power state will change (ac plugged in or running on battery), laptop mode will do what you configured.
In /etc/default/acpi-support, look for this line:

# Switch to laptop-mode on battery power - off by default as it causes odd
# hangs on some machines
ENABLE_LAPTOP_MODE=true

Links

A good article about Laptop-Mode can be found here: Linuxjournal.com
The Laptop-Mode FAQ can be found here: Laptop-Mode FAQ

devlog/blog/laptop-mode.txt · Last modified: 2008/05/12 23:58 by x4
Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! DevLog Atom feed Valid XHTML 1.0