3

I recently upgraded from 11.04 to 11.10, but I get "Not enough free swap" error when trying to put my laptop to hibernation.

I have 2GB of physical memory and 3GB of swap. Besides, the hibernate worked fine in 11.04.

And the memoinfo is here:

SwapCached:            0 kB
SwapTotal:       4028604 kB
SwapFree:        4028604 kB

So what might be the problem?

Jorge Castro
  • 71,754
  • which program tells you that error? please paste the meminfo output as I showed in my answer. – cweiske Oct 30 '11 at 16:45
  • Are you still looking for help or did you find an answer to your question? If you found an answer please consider adding it here. Thanks :) – coversnail Apr 05 '12 at 15:12

4 Answers4

1

Check your swap status:

$ cat /proc/meminfo |grep Swap
SwapCached:       216692 kB
SwapTotal:       5855624 kB
SwapFree:        5162340 kB

You will see how much swap is free for you to hibernate. Probably you've got too many applications running that take too much RAM.

cweiske
  • 3,307
  • 2
    Thanks for the reply. I checked swap before hibernate and I'm sure there's more than enough for the whole RAM to live in the swap, but the problem remains. – Derrick Zhang Oct 30 '11 at 08:31
1

make your swap drive 2x as big as your physical memory. that seems to be the rule of thumb

frodowiz
  • 31
  • 1
0

Are you swapping into a file? Check the fragmentation in the filesystem.

At boot time there are no drivers or filesystems available so the kernel just streams the data back into ram. Therefore, at hibernation time it needs to just stream the data into the swapfile. If the file is fragmented, only the first fragment can be used.

Check the fragmentation with e4defrag -c /swapfile. Fix it with e4defrag -v /.

Why do you defragment the whole root filesystem if only one file needs to be defragmented? well, other files could be defragmented enough but cluttered over the disk such that there is just no big enough area for the swapfile to shrink to one extent.

queeg
  • 235
0

I think you should increase your SWAP size. Try with double what you have now. To change your swap size you need to boot from a live-cd. and change the swap partition, I suggest you do it with gparted.

  • sudo apt-get install gparted

Now just find your SWAP partition and change it to the size you want, I suggest 5GB or more.

Sources:

Alvar
  • 17,058