2 ms·
Having a big enough swap partition to get a kernel core dump is handy. If you hibernate to swap, that needs to be big enough too. Sometimes swap partition is be
by toast0 3y ago
Having a big enough swap partition to get a kernel core dump is handy. If you hibernate to swap, that needs to be big enough too. Sometimes swap partition is better than swap file, but a partition is harder to resize.
Personally, I find utility in having something approaching max(512mb, 2xRAM) swap available. If you've got an older system, 2xRAM is a good rule of thumb, but not for larger ram. IMHO, swap usage falls into two categories: slow leak and fast leak. In a slow leak, size doesn't really matter, just that it's being used, you can set your alert at 10% (or 75% or wherever) and you'll hit it eventually regardless of underlying size, in the mean time everything works fine, no big deal or urgency. In a fast leak, the system tends to get really slow really quick, until you hit the swap limit and then things usually get broken and fast; maybe if you get in early you can kill things before it spirals, but chances are you won't, and you'll just need to wait until you hit the max and then pick up the pieces; having a small swap means the time of max swapping is pretty limited.
TLDR: a small swap partition gives you a clear indication of a slow leak, but doesn't prolong agony during a fast leak.
Also note, measuring used memory is hard, but measuring used swap is easy. If your system typically has 0% swap used (which it should!), and starts swapping, you know something changed to use more memory (or the kernel swap algorithms changed)