Friday 30 December 2011

Swap Space in Linux / RHEL / CENTOS / Fedora

What is a Swap space?
  • Swap space is harddisk space that extends system RAM.
Swap space or virtual memory is hard disk space that acts as an extension of system RAM. Of course, due to the relative differential in data access on RAM versus hard disk, we prefer not to use swap space if it can be avoided. Nonetheless, it is vital to the proper functioning of a typical Linux system that some swap space  be made available.

Swap space is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files (a swap file can be used, provided the space has been pre-allocated using a tool such as dd).

The size of your swap should be equal to twice your computer's physical RAM for up to 2 GB of physical RAM. For physical RAM above 2 GB, the size of your swap should be equal to the amount of physical RAM above 2 GB. The size of your swap should never less than 32 MB.
Using this basic formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap.

Click here to see How to Create Swap space.

No comments:

Post a Comment

Navigation by WebRing.