Friday, May 23, 2008

Enabling Hibernate on Linux

Yesterday, I was thinking to enable hibernate on
my HP-Compaq nc-6400 laptop.
Some prerequisites for enabling hibernate on Linux:

(i). ACPI should be enabled in Linux kernel.
I have compiled kernel 2.6.22.6

(ii) Go to KDE Control Center > Power Control
> Laptop Battery. Then select 'ACPI Config',
click 'Setup Helper Application'. If ACPI
is supported on your PC, you can see that
check boxes are enabled.

(iii) kpowersaved daemon should be installed.

(iv) You should have swap partition >= RAM on your
PC.

I did not have the swap partition. :( Then I thought
to create it. Because swap file cannot act as resume
device. i.e. At the boot time kernel should know the
resume device before file system.

How did I create swap partition? Following are the
steps:

(a) I created 1 GB partition /dev/sda3 from /dev/sda2
using gparted.

(b) I formatted it and made swap.

# mkswap /dev/sda3

(c) To mount it (as swap) automatically at boot time,
it created following entry in /etc/fstab.

/dev/sda3 swap swap defaults 0 0

(d) I then modified /boot/grub/menu.lst , to make /dev/sda3
as resume device.

I changed booting kernel line from
kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda1 ro
to
kernel /boot/vmlinuz-2.6.22.6 root=/dev/sda1 ro resume=/dev/sda3

(e) Then I rebooted the kernel with resume device. Now I
can hibernate (Suspend to disk) my laptop, using kpowersave
available in KDE tray.

No comments: