Not enough free swap space to hibernate

Vincent Trouilliez vincent.trouilliez at modulonet.fr
Wed Mar 25 12:45:01 UTC 2009


> The only way to force swap to be emptied is to close running programs to
> free RAM.

I have the same problem, Ubuntu often uses lots of swap even though
there is bags of available RAM, therefore slowing down the system with
lots of useless disk access).

I found that closing all programs doesn't empty the swap at all. All it
does is get (some of, not all) the RAM.

The solution I found to empty the swap is to disable it: it forces the
kernel to empty it first. Then I just re-enable it as soon, and I the
system starts from a clean sheet so to speak.

To disable swap: 

$ sudo swapoff -a

Then re-enable it:

$ sudo swapon -a


There is also another use case for this off/on trick:

When I was (not using it anymore) the Hibernation feature, I noticed
that when resuming, the system was very slow... it was using swap a
lot, even though zero swap was used before hibernating was triggered.
So you basically have a responsive/snappy system before hibernating,
and when resuming, ytou get a slow system... how nice.

So turning the swap off/on following a resume, fixed the problem.


HTH

--
Vince




More information about the ubuntu-users mailing list