Swap space for Linux

What is Swap? 

How much is really needed ?

Linux divides its physical memory (RAM) into chunks called pages. Swapping is the process whereby pages get transferred to a preconfigured hard disk area. The quantum of swap space is determined during the Linux installation process. This article is all about swap space, and explains the term in detail so that newbies don’t find it a problem choosing the right amount of it when installing linux

Swapping is required for two reasons:

  • When more memory than is available in physical memory (RAM) is required by the system, the kernel swaps less used pages and gives the system enough memory to the run the application smoothly.
  • Certain pages are required by the application only at the time of initialisation and never again. such files are transferred to the swap space as soon as the application access these pages.
Earlier rule stated that the amount of the swap space should be double the amount of physical memory (RAM) available. i.e. , if we have 8 Gb of RAM , then we ought to allot 16 Gb to the swap space , But this is not very effective these days.

Amount of swap space depends on the kind of application you run and kind of user you are 

The following rules can effectively help to improve Linux’s performance on your system

For Normal Servers:

  • Swap space should be equal to RAM  size if RAM  size is less than 2 Gb
  • Swap space should be equal to 2 Gb if RAM  size is greater than 2 Gb . , 

For heavy duty servers with fast storage requirements:


  • Swap space should be equal to RAM  size if RAM size is less than 8 Gb
  • Swap space should be equal to 0.5 times the size of the RAM if the RAM  size is greater than 8 Gb
if you have already installed Linux, you can check your swap space by using the following command in the Linux terminal :

Last login: Wed Aug 27 00:47:38 on ttys001
Linuxbox:~ IMPIZA$  cat/proc/swaps _ 

Pin It on Pinterest