Swap and hibernation

Posted by maaartinus on Ask Ubuntu See other posts from Ask Ubuntu or by maaartinus
Published on 2011-03-10T11:12:37Z Indexed on 2011/03/10 16:19 UTC
Read the original article Hit count: 351

Filed under:
|

I saw a lot of recommendations claiming that for hibernation the swap partition/file must be at least as large as the main memory. This makes no sense to me. Lets assume I have 8 GB of main memory and 8 GB swap area and want to hibernate:

  • case 1: I'm using 4 GB of virtual memory -> 8 GB of swap is unnecessarily large.
  • case 2: I'm using 8 GB of virtual memory -> 8 GB of swap is just right.
  • case 3: I'm using 12 GB of virtual memory -> 8 GB of swap is too small.

The outcome is: A swap area of size equal to the memory size is sufficient for hibernate IFF it doesn't get used for swapping at all. So what is the reason behind the claim that you need at least as much swap area as main memory for hibernate to work?

I know that virtual memory gets used for caching too, and that the cache may be simply discarded, but what happens to hibernation if a program allocates 12 GB of virtual memory (given the above memory and swap sizes)?

© Ask Ubuntu or respective owner

Related posts about hibernate

Related posts about swap