Not enough free swap space to hibernate

Derek Broughton derek at
Wed Mar 25 15:31:48 UTC 2009

Vincent Arnoux wrote:

> Hello the list,
> I have 1 GB or RAM and 1 GB of swap. I reboot rarely my laptop, but
> instead suspend it to disk. After a few days and intensive use of
> RAM/swap (virtual machines essentially), I end up when trying to
> hibernate with the message: "Not enough swap".
> During hibernation, RAM is being written to swap partition. If there
> is not enough space, suspend to disk just fails. How can I force my
> swap to be emptied? I could use a swap file, but I read Ubuntu current
> kernel can't hibernate using a swap file.

You can't force your swap to be emptied (except by stopping all processes),
though you can minimize it by making sure you're using no more programs
than can fit in your real memory and then doing something with all of those
programs (to force them to swap back in), and you can't expect to be able
to hibernate with no more swap memory than real memory.

While there's a lot more actually happening, think of hibernation as simply
swapping out _all_ current processes.  This means that you need enough
space in there for all the storage of all the current programs, which
generally means about 2x your real memory.  

otoh, if you simply save your virtual machines (ie, hibernate them in their
own files), you shouldn't have an issue with your other memory.  Hibernate
supports the concept of stopping/starting services when hibernating and
resuming, so you could write a script to save/restore the VMs.

More information about the ubuntu-users mailing list