If you hibernate and there's not enough free swap, a message is shown after the whole desktop environment is closed.
Therefore it is only possible to reboot.

Can I check via script (or anything else) if there's enough swap space before everything is closed?



The problem you see here is that the kernel has to allocate enough free swap pages to write the hibernate image and this includes some meta-data overhead too. Unfortunately the kernel can only figure out how many pages needs writing to swap after it has quiesced the processes and this is late in the hibernate process. The hibernate in theory should bail out if there are not enough free pages and return you back to a running system, so the fact that you seem to need to reboot looks like a bug to me.

As a rule of thumb, one generally sizes swap ~2 x the size of the available RAM, so running out of swap on hibernate shouldn't really fail because of lack of free swap; however it is a little more complex due to the possibility of having pages already swapped out and the small amount of meta data overhead required to write out the hibernate image.

  • First of all thanks for your reply! Isn't the required amount auf swap space equal to the allocated RAM? And is there any option to tell the system to clear the swap space for the hibernation process? – Achim A Sep 1 '12 at 19:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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