Tuesday, 22 July 2014

swap partition with lvm in linux rhel6.5

#df -hT (for checking partions in linux)

then you need to check swap is created or not

#free -m

it will shows the swap size example output is below

[root@mudskipper ~]# free -m
                    total       used       free     shared    buffers     cached
Mem:          7685       4981       2703          0        189        547
-/+ buffers/cache:       4244       3440
Swap:            0             0             0

here Swap is mentioned zero

then you need to create partition lvm and add to swap

#lvcreate -L 16GB -n swap LVNAME

16GB is the swap size

# mkswap /dev/mapper/LVNAME-swap

then you need to enter the entry in fstab for permanent mount

#vi /etc/fstab

/dev/mapper/LVNAME-swap swap     swap    defaults        0 0

:wq (for saving the file)

check the swap is created or not

#free -m

                     total       used       free     shared    buffers     cached
Mem:          7685       4981       2703          0        189        547
-/+ buffers/cache:       4244       3440
Swap:        16383          0      16383

that's it your swap partition is created

No comments:

Post a Comment