Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

Thanks

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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