Web lists-archives.com

Re: Recommendation on partition sizes

On Sun, Nov 04, 2018 at 10:45:04AM -0500, Stefan Monnier wrote:
/swap, encrypted, 16GB (same as RAM)
Hugely overkill. You do not need for your swap to be as large as
your RAM unless you are intending to hibernate to disk. If you are
intending to do that, fair enough, but if not, that's probably 12+
GiB of expensive SSD that sits idle forever.

A large part of the data in RAM is made up of the disk-cache, and that
doesn't need to go to swap during hibernation.  Furthermore, the
remaining data can be compressed before being written to swap, so the
hibernation data takes a lot less space than your RAM, something like
1/3 maybe, in my experience.

IOW 8GB of swap should be plenty even in case of hibernation.

Telling people how much swap they need is just silly. The amount of swap you need depends on how much memory it takes to run all of your programs, minus the amount of physical ram that you have, plus a safety factor and possibly plus the amount of ram it takes to hibernate, if you're going to try to do that. My desktop has 16G of RAM, and the other day I had 12G consumed by a web browser and 13G consumed by another program. If I followed your "8GB is plenty of space" rule I'd have run out. In this case I was fine because the swap is SSD backed and reasonably fast, and because most of the consumption was a browser being stupid and holding onto memory that wasn't actively trying to use. On servers I tend to see much less swap pressure because the apps aren't as dumb about memory management, or there's much more physical RAM anyway.