Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
Adding swap partition after system installation

I got 8GB RAM on my laptop but only partitioned 1GB for swap, now the hibernation cannot be achieved even if I use sudo pm-hibernate.

Is there any solution?

share|improve this question

marked as duplicate by Takkat, Jorge Castro, hhlp, Ringtail, belacqua Nov 7 '12 at 16:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
For creating a swap file (no need to re-partition) see: askubuntu.com/questions/126018/… –  Takkat Nov 7 '12 at 8:32

2 Answers 2

Hibernation basically writes the contents of RAM to disk, using the swap partition. So, for hibernation to work, you need a swap partition not smaller than your RAM - I'd try something like 10Gb.

From SwapFAQ:

Hibernation (suspend-to-disk) The hibernation feature (suspend-to-disk) writes out the contents of RAM to the swap partition before turning off the machine. Therefore, your swap partition should be at least as big as your RAM size. The hibernation implementation currently used in Ubuntu, swsusp, needs a swap or suspend partition. It cannot use a swap file on an active file system.

You'll need to boot from a LiveCD and use gparted to resize partitions.

share|improve this answer

I'd suggest increasing the size of the swap partition if you can. Traditionally swap was twice the size of the RAM but you could probably get away with 4Gb.

You should also look at how much of the swap space is getting used with something like activity monitor.

share|improve this answer
    
4Gb won't help... –  Sergey Nov 6 '12 at 23:59
    
I guess it depends how big his RAM usage is. If its more than 4Gb your right 4Gb probably won't help. –  niallhaslam Nov 7 '12 at 0:06
    
That's an interesting point you're raising here - does hibernation write ALL memory in one continuous 8Gb blob, regardless of how much is used by applications, or just the areas which are in use by the system/applications? I'm not sure although I suspect the former may be the case. Do you have any info on this? –  Sergey Nov 7 '12 at 0:11
    
Assume the worst-case scenario. I have 16GB of RAM and hibernate works well (there's a 5-10 second period during the boot where I can see it reading the hibernate data back into memory). If I had to guess I would say it writes out the full capacity of the RAM, i.e. 16GB RAM = 16GB hibernate storage. I base this on the observation that a restart from hibernate seems to take the same amount of time from a heavy or light session. I have 20GB of swap space because... why not. Consider the cost of storage vs. the cost of RAM (even on an SSD) and over-allocate for swap. –  Aaron Newton Nov 7 '12 at 4:13
    
I doubt the entire ram is written to swap all the time, only the effective content, otherwise the disk write operation should be a lot slower than what I observed on my system with 4G –  prusswan Apr 24 '13 at 1:39

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