TracNav
- Home
- Research Overview
- MPhil Information
Research Projects
- Wireless Comms
- Bat System
- Broadband Phone
Visual tags
- Sentient Vehicles
- Task Assignment
- NLMaP
- Computing for the Future of the Planet
- SESAME
- Active Floor
- Open-Source CSK Energy
Development Info
DTG Local Pages
- Cambridge Weather
- Contact Details
Suspend to disk or to RAM for Gentoo
In order to be able to suspend to disk (hibernate) or to RAM (STR), you need a kernel patched with suspend2. Gentoo provides such a kernel, which includes all the Gentoo improvements and the suspend2 patches. This howto describes the easier procedure by using the Gentoo suspend2 kernel to suspend to the swap partition.
A detailed HOWTO, including manual patching, troubleshooting, other suspend methods etc., from which this one was inspired is available here.
First, emerge the suspend2 kernel sources and start the kernel configuration.
emerge -av suspend2-sources cd /usr/src/linux-*-suspend2* make menuconfig
Now you should activate the suspend2 features and enable LZF compression (faster suspending/resuming and saves space):
Power management options --->
[*] Software Suspend 2 --->
[*] File Writer
[*] Swap Writer
[*] Warn if possibility of filesystem corruption
Cryptographic options --->
<*> LZF compression algorithm
Do not worry about the empty Default resume device name option. We will set this in the kernel line in grub. You need to set the above options in kernel and not as modules as they need to be available when resuming. After this, launch the usual make sequence:
make make modules_install make install
Once the above sequence has completed (without errors, of course) then add an entry in your grub's menu.lst for the suspend2 kernel:
title=Gentoo Linux 2.6.12-suspend2-r6 root (hd0,0) kernel /vmlinuz-2.6.12-suspend2-r6 resume2=swap:/dev/hda2 root=/dev/hda3
Replace 2.6.12-suspend2-r6 with your suspend2 kernel release, /dev/hda2 with your actual swap partition and /dev/hda3 with your actual 'root' partition. If you are unsure about the swap partition then you can issue cat /proc/swaps to see which partition is your swap partition. You can copy the 'root' partition from the working kernel line entry in menu.lst.
You should make sure that your swap partition is at least as large as your physical RAM size. Even though you might be using LZF to compress the hibernate file, it is still a good idea to have your swap partition >= RAM size.
You should make the suspend2 entry in your menu.lst the default one so that you always resume from hibernation in case grub's kernel selection screen times out.
Add the hibernate-cleanup script to the default run level:
rc-update add hibernate-cleanup default
Before you hibernate for the first time, you must boot with the suspend2 kernel with the resume2=:
reboot
After reboot you should simlate a suspend, which will tell you of possible errors and fixes:
hibernate --no-suspend
If everything looks good, you can hibernate by doing:
hibernate
To suspend to ram, you issue hibernate-ram.
For further details, like suspending to a file on a non-swap partition (FileWriter) or troubleshooting, please see the full HOWTO or the official Gentoo power management guide.
The Suspend2 project can be found here.
