I'd like to understand how the hibernation process works in Linux, with regards to memory size and swap.
Is hibernation limited to swap partition size? What does it do when RAM doesn't fit?
Consider an installation (of Ubuntu, for example) with a swap partition that's smaller than (let's say half the size of) the RAM.
Let's say I open lots of programs, browser tabs, etc, and it hibernates (either manually or because of low battery).
If I need to hibernate when RAM is full (and doesn't completely fit in swap partition) will the system automatically fall back to saving the rest of the memory in a swap file by default?
If not, will it start killing processes, discarding memory pages or something like this to make it fit in the partition?
What if there's no swap? Will a standard installation use swap file automatically by default, at least for hibernation?
If hibernation still works regardless, I presume there wouldn't be much of a reason for using a swap partition that's bigger than RAM nowadays, if you consider your RAM big enough, right?
Related:
What happens to data in swap when your computer hibernates? (don't know if answer still applies)
What you can generally expect if there isn't enough swap space is that hibernation will fail