How to create swap partition / space

by admin November 9, 2016 at 3:41 pm

Swap space in Linux is utilized when the usage of physical memory (RAM) is full. When the physical memory is full and if the resources needs more memory then the inactive pages in memory are moved to the swap space. Swap space is not a substitution of RAM, it can help the server little amount when the RAM is fully utilized.

To see existing swap partitions and swap size. As per below output, current swap partition size is 2 GB.

# swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2064376 0 -1

[root@ramesh ~]# free -m
total used free shared buffers cached
Mem: 1002 377 624 0 55 200
-/+ buffers/cache: 121 880
Swap: 2015 0 2015

We are going to increase the swap space to another 1 GB and this can be done in 3 ways.

1. From raw disk
2. Swap file
3. LVM

Add Comment