5

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
  • 73,717

5 Answers5

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,395
1

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

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

  • swapoff ...; e4defrag -v /; swapon ...
  • Alternatively, create a new file, then defragment before running mkswap.

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
  • 265
0

In my case, I checked it all and everything seemed to be correct but I when I executed sudo systemctl hibernate... I saw the "Call to Hibernate failed: Not enough suitable swap space for hibernation available on compatible block devices and file systems" message.

So, I tried rebooting the computer and... sudo systemctl hibernate was successful from that moment.

Ganton
  • 446
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,038