A: Swap space is an area on disk that temporarily holds a process memory image. When physical memory demand is sufficiently low, process memory images are brought back into physical memory from the swap area on disk. Having sufficient swap space enables the system to keep some physical memory free at all times.
Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.
The size of your swap space should be equal to twice of your machine’s memory.
First to determine the amount of available swap space, use the “swapon” command:
Filename Type Size Used Priority
/dev/cciss/c0d0p5 partition 2907724 0 -1
swapon – enable/disable devices and files for paging and swapping
total used free shared buffers cached
Mem: 3547 670 2877 0 78 385
-/+ buffers/cache: 206 3341
Swap: 8839 0 8839
free – Display amount of free and used memory in the system
The value in the free column indicates the number of free blocks, where a block is 512 bytes.
To convert blocks to KB, divide the number by 2. For example, 2,000,000 free blocks is equivalent to 1,000,000 KB.
If you do not have enough swap space, perform the following tasks:
First you need to create a empty file:
root@techgyaan:~#dd if=/dev/zero of=/swap_file count=4096 bs=1M
dd – convert and copy a file, dd command, /dev/zero can be used to fill a file with a given number of the ‘