Hibernate brokes my swap partition.

Derek Broughton news at pointerstop.ca
Mon Mar 13 18:06:20 UTC 2006

Carl Karsten wrote:

> Can someone explain or give me a URL of how this works?  How can it use
> the swap
> partition?  Let's say I have 512mb ram and 1g swap.  I run some apps that
> use
> all the ram and all but 100mb of swap.  What happens when it hibernates?

OK, I don't know the details of the implementation (I did a few years back,
but it didn't actually work for me then :-) ), but essentially:

- freeze all processes: at this point the only thing that runs is the
hibernation code
- flush all read-only pages out of virtual memory (it's possible that it
actually only gets rid of as much as it needs): on startup, the swapper
will reload them for processes that need those pages back.  On most
systems, many of those pages are never going to be reused anyway.
- copy all real-memory pages to swap: fail if there isn't enough swap space.
- change the swap-space signature so that the boot code can recognize it
- halt. 

on boot:
- recognize the swap-space signature, and go into resume mode
- fix the swap-space signature
- start

Then the first thing the OS swapping routines are going to do is bring some
of those swapped pages back into real memory.

More information about the ubuntu-users mailing list