Desktop hard drives are usually rated for only 40,000-50,000 spinups, and one spinup every 10 minutes will kill your 40,000-spinup HD in 277 days. So this is NOT recommended for server use, unless you increase the spinup interval dramatically, to say once every hour or two. Laptop hard drives are usually rated for around 300,000 spinups, so those will last about 2083 days or 6 years if you have them powered on 24-7.
If you have laptop mode enabled and your machine crashes, then you will lose up to MAX_LOST_WORK_SECONDS seconds of work. If you really need to have something written to disk, issue the "sync" command. If you have laptop mode enabled and your machine runs out of power, you will not lose as much work (provided you have an ACPI laptop, as most current PC laptops are) because laptop mode is automatically disabled when the battery almost runs out.
There's an article in the Linux Journal September 2004 issue. It can be found online at http://www.linuxjournal.com/article/7539. It's not really up-to-date anymore BTW. The most important conclusion from the article is that it doesn't really pay to increase the spun-down time over a minute. I often get mails in which people tell me that they want to go up to one hour or more without disk activity. This is nice for noise reduction purposes, but not for saving power.
I did a talk on power saving, Laptop Mode and the Laptop Mode Tools at FOSDEM 2006. A pdf version of the presentation can be downloaded here.
Nothing really. You use Smart Spindown if your hard drive can't spin down by itself, or if you're irritated by repeated spindown attempts while you're actually actively using the computer and don't want spindowns at all. It's not well-integrated with Laptop Mode Tools and it isn't maintained at the moment, so I'd advise against using it. :)
Laptop Mode Tools is a fork of the script in the kernel documentation. The script in the kernel documentation is currently pretty much unmaintained AFAIK, so I don't recommend using it.
There is a big thread about this on ubuntuforums, http://ubuntuforums.org/showthread.php?t=36976. Ubuntu used to have a rather outdated package for controlling laptop mode, based on the aforementioned kernel documentation script. Laptop mode tools basically is a much more recent version of the same code. Ubuntu has switched to laptop-mode-tools somewhere in 2006.
It doesn't. Don't install both together. Noflushd does the same thing for your disks as laptop mode tools if you don't run a journaling filesystem such as ext3, ReiserFS or XFS. If you do, Laptop Mode Tools is currently your only option.
Execute cat /proc/sys/vm/laptop_mode. If it contains a nonzero value, then laptop mode is enabled, if it says 0, then it isn't.
Well, this file is created and destroyed by the laptop-mode init script to enable/disable laptop mode activity. If this file is not present, then laptop mode tools will not do a thing except disable itself, even when you unplug your computer from the mains.
That's only supported for backward compatibility with the old Ubuntu laptop-mode package. It contains a setting using which you can enable or disable laptop mode entirely.
Yes, kind of. If you want to manually control laptop mode, you need to set all ENABLE_LAPTOP_MODE_* to 1, and then control laptop mode by manually calling the /etc/init.d/laptop-mode script with the "start" and "stop" arguments.
Note that the /usr/sbin/laptop_mode command does not support the "start" and "stop" commands anymore. These commands interfere with the low-battery detection code, and they default to "auto" for that reason. This design flaw will be corrected by the 2.x major release, which will feature a profile-based configuration system that will allow manual profile switching without interfering with the low-battery detection code.
They may be relevant, because (a) laptop mode will reduce the number of writes, which improves the lifetime of an SSD, and (b) laptop mode makes writes bursty, which enables power saving mechanisms like ALPM to kick in. However, your mileage may vary depending on the specific hardware involved. For some hardware you will get no gain at all, for some the gain may be substantial.
Set HD="/dev/hdX /dev/hdY" in /etc/laptop-mode/laptop-mode.conf, where /dev/hdX and /dev/hdY are the device names that you want laptop mode to affect. This doesn't quite work though: the kernel switch (which delays all writes) doesn't discriminate between drives. You can also limit which partitions are affected by the remounting, using the PARTITIONS configuration setting, but again, this doesn't fully disable laptop mode for the other partitions.
You have to include the default partitions (the partitions of the drives listed in the HD configuration setting) as well. In version 1.06 and higher you can use the "auto" keyword to indicate "and remount all of the default ones as well". "Default" here means "partitions that contain the device name of a hard drive in HD", i.e. if your partition is /dev/hda3 and you have HD=/dev/hda, then /dev/hda3 is part of the default partitions, but if it is aptly named
/dev/hdx7 then it isn't. :)
You have to include the partitions' devices, not their mount points. So you should list things like "/dev/hda2 /dev/hdb1". If you're using version 1.06 or higher then you don't have this problem, as this version supports mount points as well as device names in REMOUNT_PARTITIONS (or PARTITIONS, as it's called in the new config file format introduced in version 1.07).
Yes, you can. In syslog.conf, you have to place a dash (-) before the log file name, e.g. the line kern.* /var/log/kern.log becomes kern.* -/var/log/kern.log. In addition, you can use lm-syslog-setup (included in laptop mode tools) to use different syslog.conf files based on whether you're running on battery or on AC power. This creates three different syslog.conf files in /etc: syslog-on-battery.conf for battery mode, syslog-on-ac-with-lm.conf for AC mode with Laptop Mode enabled, and syslog-on-ac-without-lm.conf
for AC mode with Laptop Mode disabled. Laptop mode tools will then take care of syslog.conf, by making it a link to the appropriate config file based on the power and laptop mode state. After running lm-syslog-setup, you can perhaps modify the "battery" version of the syslog.conf so that it never syncs, while leaving the syncs intact when you're on AC.
The configuration setting is in kilobytes, hdparm reports readahead in 512-byte sectors.
Yes, you can. But first, check that you have modified your syslog.conf to not sync, as described in the last question of the previous section. To debug disk activity, you can do:
echo 1 > /proc/sys/vm/block_dump
(Warning: you must disable syslogd before you do this, or you must make sure that kernel output is not logged. If you forget this, your system may get into a feedback loop, where syslogd causes disk activity, this causes kernel output, and this causes syslogd to do more disk activity, etcetera!)
This enables file/disk activity debugging in the kernel. You can read the output using dmesg. When you're done, disable block dump using
echo 0 > /proc/sys/vm/block_dump
NOTE: Recently a tool called lm-profiler was added to laptop-mode-tools, which does all this for you. It also detects network services that you might not want running, and it can install the services' init scripts into laptop mode's new "start/stop" directory structure, so that they are automatically stopped when you are working on battery.
In some cases this is caused by smartmontools. The smartd daemon installed by smartmontools regularly (once every half hour) checks the SMART monitoring information on your hard drives, and for some hard drives this causes the drive to spin up. The solution is to use the -n standby,q option of smartd. This option instructs smartd to refrain from checking the disk when it is spun down.
Another thing that doesn't show up in the lm-profiler output is if the disk is configured to do automatic offline tests. Disks to these at regular intervals (every four hours, according to the smartctl manpage).
This problem is very nasty, because it is very hard to detect it -- /proc/mounts will list the rootfstype as rootfs, which tells you nothing, and mount as well as /etc/mtab will tell you the fstype is in fact ext3 -- which is an incorrect guess, taken from /etc/fstab. It puts your data at risk because you do not have journalling enabled, while you think you do. I've added a BIG FAT WARNING text when this happens in version 1.06 of laptop mode tools.
I got a tip from Ian Allen on how to check for this: you can use dumpe2fs -h on the partition to get the file system properties. If the file system is listed as "not clean" and "needs_recovery" while it is mounted, then it is mounted as ext2. According to Ian, ext3 file systems list as "clean" even when they are mounted.
Then hdc is probably a CD-ROM drive, not a hard drive, and you should remove it from the HD parameter in /etc/laptop-mode/laptop-mode.conf. Fortunately, this doesn't actually break anything, so you can simply ignore the error messages as well. Recent versions of laptop-mode-tools correctly autodetect CD-ROM drives, so the error messages should be gone if you upgrade to the most recent version.
Spindown timeouts don't currently work on SATA drives, because the Linux kernel does not support that properly. There are patches available that add this support. Check out http://www.thinkwiki.org/wiki/Problems_with_SATA_and_Linux for all SATA-on-Linux problems. For laptop mode to work, you want the libata_passthru patch. It will be included in the Linux kernel starting from version 2.6.15. Note: You also need a recent version of hdparm in order to make this work!
Starting from version 1.20 laptop-mode-tools supports SCSI drives. You have to make sure you have sdparm installed though! And I haven't actually tested it because I don't have any SCSI drives, so if you have any luck with this, please let me know.
This is caused by the fact that Slackware doesn't follow the Filesystem Hierarchy Standard and it doesn't completely clear /var/run on boot. It will work when you include a call to
in your rc.local.
If you are running pmud, then you need to have the line "/usr/sbin/laptop_mode auto" in the file /etc/power/pwrctl-local. Version 1.05 and higher add this automatically, I just haven't had any reports that this actually works so be warned. Versions 1.05 and up also install pbbuttonsd support, so that should work fine as well. Report back to me if it doesn't!
If you don't have that much RAM, you probably want to consider lowering the READAHEAD value in /etc/laptop-mode/laptop-mode.conf. The default used to be 8MB, it was lowered to 3MB in version 1.05 for exactly this reason.
This is caused by the introduction of write caching control. Apparently disabling the write cache makes some drives horribly slow. Set DO_WRITECACHE=0 (version 1.06) or CONTROL_HD_WRITECACHE=0 (version 1.07 upward) to fix this. In a future version, this may be fixed by only disabling the write caches when the battery level is low. Note that writecache control is disabled by default in more recent versions.
Some drives override the idle timeout setting (hdparm -S) when you also set an aggressive power management level (hdparm -B). Set
CONTROL_HD_POWERMGMT=0 (supported from version 1.07) to stop laptop mode tools from fiddling with the HD power management setting.
Well, some drives have a specific minimum to the idle timeout values they support. Try increasing the value to 120 seconds and see if that works, then work your way back to the lowest value that still works.
This is a bug in hardware or the Linux kernel, triggered by something laptop mode tools does. Try setting CONTROL_HD_POWERMGMT=0. This fixes the freezes for some people. The default for CONTROL_HD_POWERMGMT was changed to 0 in version 1.11 for exactly this reason. Otherwise, for now, downgrade to a kernel 2.6.10 or earlier.
There has been a lengthy thread on the Linux Kernel mailing list about this, and the cause was determined to be the ipw2200 wireless network driver, version 1.0.8 (http://bughost.org/bugzilla/show_bug.cgi?id=821). This driver causes random memory corruption after some amount of network activity, and it will write a message "Firmware error detected. Restarting." to the kernel output. The memory corruption only happens the first time the message is shown (unless you have compiled the driver with some debugging options set), and can corrupt pretty much anything, including filesystem (meta)data that resides in memory. The chance that the overwritten data is, in fact, filesystem data is larger when you're running laptop mode, because laptop mode keeps filesystem data in memory for a longer period of time, thereby
increasing the proportion of memory that contains filesystem data.
This could be because laptop mode tools does not notice that the LVM partitions are on one of the hard drives that are listed in the HD configuration setting. You should list the devices by hand in the PARTITIONS configuration setting. (But: also check out the items on this configuration setting in the Configuration section of the FAQ!)
This is caused by SELinux controlling acpid / apmd. How to change this in FC4 (contributed by Vesko T. Tomov):
Some guy decided to delete the whole /proc/acpi/buttons directory, without creating a replacement. It was reintroduced in 2.6.13, so I suggest that you upgrade.
That's because Laptop Mode Tools remounts your filesystems with the "noatime" option, which prevents the updating of access times, while mutt is one of the few programs that actually use the access times. Set DO_REMOUNT_NOATIME=0 (CONTROL_NOATIME in recent versions) in laptop-mode.conf to fix this. Note that the default for this option has been changed to 0 recently.
Well, you'll have to restart the laptop-mode service after resuming from hibernation. The hibernate configuration file has support for starting/stopping services, you can use that.
Yes, xscreensaver resets the X screen blanking settings. I'm trying to figure out how to fix this. Any ideas? Send me an e-mail!
Disable automatic offline testing with "smartctl -o 0". It prevents some drives from spinning down properly.
Check if it is listed as type "auto" in fstab. Laptop mode tools cannot currently detect the filesystem type if it is mounted as type "auto". If you desperately need this, drop me a line.
For kernel timer events, powertop lists the process that originally caused the events to be created. If a kernel setting tweaked by /usr/sbin/laptop_mode causes a timer to be created, then this will show up in powertop as a laptop_mode timer. However, it's not. It's usually the timer of the "ondemand" or "conservative" CPU frequency scaling governor, which is invoked every so often to adjust the CPU frequency. As laptop mode tools is the program that adjusts your CPU frequency scaling governor, it will show up as the one that is to blame.
The laptop-mode-tools package in Ubuntu is a crippled version of the Debian package, which leaves the on/off decisions largely to the acpi-support package. Of course, they failed to mention this in the laptop-mode.conf file and in the manual pages, so that nobody actually knows this. They also failed to mention that the file /etc/default/acpi-support can even turn laptop mode off completely.
The Ubuntu solution has various downsides. First of all, the options mentioned above don't work. Furthermore, the safety options which disable laptop mode when your battery goes critical are not functioning on Ubuntu either. You can safely install the Debian packages instead, they work fine on Ubuntu and have none of the drawbacks of Ubuntu's crippled package.
No. I'll create one if there is a lot of demand though.
You wouldn't be the first. This library can be found in various incarnations on the web, and I think there are at least half a dozen people who have contacted me saying they either wrote this library, or they were thinking about doing it. No, I will not include it in laptop mode tools, as laptop mode tools is an architecture independent package. I might add support for enabling/disabling it together with laptop mode though. I have some plans to build a clean, configurable version of this library (which would allow control at the user and process level, i.e. "disallow sync only for emacs and vi, but not when they're run by root" and which would be able to report all syncs to a log file). This would become a separate package though!
If you can write it as a plugin, to be placed in /etc/laptop-mode/batt-start or the like, then you can put it on the web yourself, and I'll gladly link to your site. I'll even put it on my site, if you don't have a website to put it on. If it's more complicated than that, or if it will benefit a lot of people, then I'll consider including it.
Read the manual pages (the one you want to read is the one called laptop-mode.conf). If that doesn't give you the answer, contact Ritesh Raj Sarraf.