Saturday, August 16, 2008

ACPI Suspend/Resume

Suspend to RAM or Suspend to disk on GNU/Linux with an ACPI enabled kernel:

First, we find out what sleep state the system supports by running
echo /sys/power/state
And we finally put the system to sleep by doing (as root) :
echo -n "X" > /sys/power/state
Where X is one of the sleep states obtained from the before mentioned command.
mem / standby - Suspend to RAM (standby)
disk - Suspend to Disk (hibernate)

Example : ( '#' prompt denotes that i'm root already)
# cat /sys/power/state
# mem standby disk
# echo -n disk > /sys/power/state # for suspend to disk (a.k.a 'hibernate')

NOTE : For suspend to disk to work correctly, pass the resume kernel parameter at boot.
kernel /vmlinuz-2.6.25-custom root=/dev/hda1 ro resume=/dev/hda4
Keep in mind that this resume partition must be a valid swap partition.

No comments: