Linked by David Adams on Thu 20th Nov 2008 04:19 UTC
General Unix Linux and other Unix-like operating systems use the term "swap" to describe both the act of moving memory pages between RAM and disk. It is common to use a whole partition of a hard disk for swapping. However, with the 2.6 Linux kernel, swap files are just as fast as swap partitions. 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?
Permalink for comment 337846
To read all comments associated with this story, please click here.
Comment by Traumflug
by Traumflug on Thu 20th Nov 2008 10:08 UTC
Traumflug
Member since:
2008-05-22

Admittedly, I never could follow the reasoning for this 2x-RAM-rule.

About any piece of software out there requires some absolute amount of RAM and doesn't care wether this RAM is available physically or not. So multiplying the physical amount of RAM with any number is meaningless. What you really want is a rule of thumb for an absolute number.

Example: Running Ubuntu with some desktop stuff needs about 1.5 GB of RAM (worst case scenario), so make sure you have 2 GB of RAM available to be on the safe side. If you have 0.5 GB physical RAM, allocate 1.5 GB swap. If you have 1 GB physical RAM, 1 GB swap is sufficient.

Nowadays, with most desktop PCs having 2 GB physical RAM or more, it's actually questionable wether you need swap at all. If you install a 32-bit OS on a machine with 4 GB physical RAM you can safely ignore swap as the OS can't even address the extra. A common scenario these days, yet most Linux distros still insist on allocating a swap partition.