Flattr this

Swap areas


A swap area is a device or file that has been designated for use as backing store for virtual memory. This increases the total amount of memory available for use by programs, but if overused can harm performance due to the need for pages to be swapped between physical memory and backing store. On Linux-based systems, swap areas are initialised using the mkswap command and activated using the swapon command.

The optimum amount of swap space (assuming plentiful disc space) is generally considered to lie somewhere in the region of 1× to 2× the amount of phyiscal memory. Beyond this range the performance of the system is likely to deteriorate, and it may be better to let the Out Of Memory (OOM) killer dispose of whichever process is using the memory rather than attempt to plough on.

Use of a swap area can be a security issue because memory that is swapped out may contain sensitive information. If this is a concern then you may wish to encrypt the swap area, or for maximum securty, provide enough physical memory that no swap space is needed.


Further reading