Linux and open source articles and tutorials based on real world projects and deployments

Add second swap partition on CentOS 6

Swap space is extremely important for Linux system. It acts like temporary storage for process memory image. There are many reasons to have multiple swap areas. We will take a look at the process of creating additional swap partition on already existing system.

In our example system was partiiotned with 3 primary partitions. / /boot and swap

Since we already have 3 primary partitions created. We will start by creting extended partition which within itself will be holding logical volume with our swap partition.
First we run parted /dev/sda print free to see all free space available

fdisk /dev/sda
n for new
e for extended
select 4 for partition number
Use default value for number of cilinders
+6G to add 6gb extended partition
p to make sure everyhtong is correct
w apply the changes