I've always thought that swap could act like an extended RAM, meaning that when RAM fills up, it could overflow into swap. So, for instance, with 31 GB of RAM and 10 GB of swap, I assumed I could have 41 GB of unique data. However, I recently learned that this isn't the case and that the total amount of unique data isn't simply the sum of RAM and swap. It seems like if I have 32 GB of RAM, swap alone doesn't increase that limit. Also, I understand that to safely use hibernation, I would need at least 33 GB of swap, which confuses me since it seems like it would overwrite what RAM space I could use that is extended in swap. Can anyone provide a clear explanation or credible links to guides on how swap actually works?
3 Answers
Honestly, it's not smart to depend on AI for these types of questions. Instead, do some digging yourself! Check out these great resources: [Arch Linux Wiki on Swap](https://wiki.archlinux.org/title/Swap), [GeeksforGeeks on Swap Space](https://www.geeksforgeeks.org/operating-systems/swap-space-in-operating-system/), and even [Wikipedia's Memory Paging](https://en.wikipedia.org/wiki/Memory_paging). They'll give you a more accurate breakdown of how swap functions in relation to RAM.
Swap memory isn’t exactly extra memory; it acts like a backup when your RAM gets too full. The system moves info from RAM to swap as needed. To make hibernation work, generally, your swap space should be at least as big as your RAM. I run Debian with only 8 GB of RAM and had to utilize swap on my older MacBook when programs pushed limits. It’s useful when you’re running low on physical RAM and can be critical for stability especially on older machines.
Yeah, it looks like ChatGPT got it wrong. When you hibernate, RAM compression kicks in by default, which helps keep things manageable. I once hibernated my laptop with 16 GB of RAM to just an 8 GB swap file! Plus, swap space is flexible; you could have as much as your disk can handle, theoretically even using a server setup. It’s not the same as having extra physical memory, but it can help out in a pinch if managed correctly.

Totally get it! I was having trouble finding clear guides too, especially while setting up Qubes. The documentation can be so outdated and confusing. I appreciate the new links!