How much swap?

Sam@lemmy.ca to Selfhosted@lemmy.world – 36 points –

I've heard a lot of people say your swap should be 2x RAM.. but do I really need 32GB of swap?

56

You are viewing a single comment

On a desktop or especially laptop case, it should be equal to (or larger than) your RAM if you use hibernation (as RAM gets copied to swap during hibernation)

On my server, I set it up to be 2GBs, mostly arbitrarily. Right now it's at 500MB, but my main memory is also only 600-800MB full out of the total 4GBs available, so I'm not running out of RAM anytime soon.

Swap behavior seems to have changed a while ago, so consider reading https://chrisdown.name/2018/01/02/in-defence-of-swap.html on how it works right now. Hell, even that might be outdated nowadays. Up to date info on how swap works really seems hard to come by.

Also make sure to count GPU memory, as that will have to be written to swap on hibernate.