Power management/Suspend and hibernate
Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end
Manually suspending the operating system, either to memory (standby) or to disk (hibernate) sometimes provides the most efficient way to optimize battery life, depending on the usage pattern of the laptop. While there is relatively straightforward support in the linux kernel to support these operations, typically some adjustments have to be made before initiating these operations (typically due to problematic drivers, modules or hardware). The following tools provide wrappers around the kernel interfaces to suspend/resume
- Wrappers: Systemd, pm-utils
- Backend: kernel, uswsusp, tuxonice
Suspension works out-of-box.
In order to use hibernation, you need to create swap partition or swap file. See Swap for details.
- About swap partition/file size
Even if your swap partition is smaller than RAM, you still have a big chance of hibernating successfully. According to kernel documentation:
/sys/power/image_sizecontrols the size of the image created by the suspend-to-disk mechanism. It can be written a string representing a non-negative integer that will be used as an upper limit of the image size, in bytes. The suspend-to-disk mechanism will do its best to ensure the image size will not exceed that number. However, if this turns out to be impossible, it will try to suspend anyway using the smallest image possible. In particular, if "0" is written to this file, the suspend image will be as small as possible. Reading from this file will display the current image size limit, which is set to 2/5 of available RAM by default.
You may either decrease the value of
/sys/power/image_size to make the suspend image as small as possible (for small swap partitions), or increase it to possibly speed up the hibernation process.
Required kernel parameters
resume=<swap_partition> has to be passed to the Kernel parameters (where
SWAP_PARTITION is either your swap device, i.e.
/dev/sdaX, or your swap UUID). Consult Kernel parameters for more info.
kernel /boot/vmlinuz-linux ... resume=/dev/sdaX
If you are using swap file instead of regular swap partition, read Swap#Swap file resuming for more info.
kernel /boot/vmlinuz-linux ... resume=/dev/sdaX resume_offset=12345
You will also need to add the
resume hook to
# resume must be placed after block and lvm2, but before filesystems HOOKS="... block lvm2 resume filesystems"
You must rebuild the initrd image for these changes to take effect:
# mkinitcpio -p linux
uswsusp (userspace software suspend) is a set of user space tools used for hibernation (suspend-to-disk) and suspend (suspend-to-RAM or standby) on Linux systems.
TuxOnIce , an advanced suspend/hibernate framework which supports suspending to a swap-disk or a regular file with fast LZO-compression.
$ systemctl suspend $ systemctl hibernate $ systemctl hybrid-sleep
# pm-suspend # pm-hibernate # pm-suspend-hybrid