Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using RHEL6 and I don't see a hibernate option for it. Doesn't RHEL6 have a hibernate option? enter image description here

I tried pm-hibernate from command line but it said:

PM: Cannot find swap device, try swapon -a

I tried swapon -a

then I again tried pm-hibernate and it showed the same message again.

PS: I don't have a swap partition in my machine.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

In order to hibernate, the system has to have somewhere on the disk to write the data that is in RAM to save it from extermination when the power goes out. There are other ways to do it, but not distros use the swap space for hibernation so as not to run into space problems on the hard drive. There is a kernel parameter to configure this, but you shouldn't need to go there.

The simplest thing would be just to create a swap file and enable it. Make it somewhat bigger than your ram. Say you have 4G ram, make a 5G swap.

$ dd if=/dev/zero of=/swap bs=1024 count=$((5*1024*1024))
$ mkswap /swap

Then enable it:

$ swapon /swap

And add it to fstab so it's enabled on boot:

/swap swap swap defaults 0 0

Lastly you need to tell the kernel when it boots where to check for potential hibernated data to boot too. In this case it needs to know where to find your swap file, so you'll need to add a kernel paramenter. You can find docs for this step in the kernel.org documentation.

Typically it would fall to the hibernate program to determine the exact location of the resume data and mark it in the boot loader.

share|improve this answer
    
I followed the link, did the first step, but I didn't get the 2nd step. Please explain. –  Chankey Pathak Jul 20 '11 at 20:03
    
@Chankey: You have to use some program to tell you where the swap file ended up in bytes from the start of the partition. I suggest you check into using swsusp to make steps 2 and 3 more palatable. –  Caleb Jul 20 '11 at 20:10
    
@Chankey: BTW did you reboot after that first step? It's possible RHEL would just recognize it and go. –  Caleb Jul 20 '11 at 20:11
add comment

You cannot hibernate unless you have a swap partition as big as the total ram on your system. Use GParted to re size your main partition and create a swap partiton

share|improve this answer
    
Having a partition is the easy way, but it's possible with just a swap file. Several hibernate scripts support passing the right parameters to the kernel that supports the resume data being anywhere it can read. –  Caleb Jul 19 '11 at 21:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.