Should You Use Twice the Amount of Ram as Swap Space For Linux?
Submitted by nixcraft on Wed, 11/19/2008 - 03:00.
Now, many admins (both Windows and Linux/UNIX) follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. Let us say I’ve 32GB RAM, should I set swap space to 64 GB? Is 64 GB of swap space really required? How big should your Linux / UNIX swap space be?
Linux: Should You Use Twice the Amount of Ram as Swap Space?


2x RAM for swap space? huh?
opsamericas.com: I came across an article here which sparked my interest in blogging about this today. Yeah i know “Big can of worms”
I am calling this “swap talk” - This kind of talk has been around since the swap file was introduced, and the kernel limits on swap were introduced. (Meaning a very very long time. Say Kernel 1.x, 2.x)
It seems i answer this question quite a bit in my travels. The truth is many admins follow an _OLD_ rule of thumb that your swap partition should be twice the size of your main system RAM. I have heard some other old rules such as… swap == ram, and Swap space == 2GB size (if RAM > 2GB). There are lots more, just google it.
Here is what it boils down to.
Swap size is apps specific ? Utility tells you swap space used ?
We cut our teeth with Windows virtual memory, when execution space is limited to 8 mB. And the original assumption was three times the dram memory.
Now Wimdows are using a minimum of 256 mB of drams, the virtual memory is 750 mB. But Microsoft auto-update will assign up to 2 gB if you have enough space on the hdd. On 2 gB hdd for WinME, auto-update assigns less than 750 mB(602.28 mB).
If swap space is leaky, meaning all used up; then you just have to give up some swap space by deleting all the previously stored files(zero out FAT or swapfs).
On Linux, where fs can be layered(aufs or unionfs), swapfs can be multiple, things can get complex, and 2x drams maybe excessive swapfs.
But a utility such as sysinfo can help to resize swap space dynamically, and you may never have any problems. Who needs problems?