Showing posts with label add swap in linux. Show all posts
Showing posts with label add swap in linux. Show all posts

How to add logical volume for swap in Redhat Linux

In our last post we have seen how to add a file for swap space.
In this post we will see how to add a LVM2 Logical Volume as swap.
Here we have a VG name VG1 in which we will create a volume LV1 of 1GB.
# lvcreate VG1 -n LV1 -L 1G
Format the new swap space using mkswap:
# mkswap /dev/VG1/LV1
Update /etc/fstab file with below entry:
# /dev/VG1/LV1 swap swap defaults 0 0
Enable the extended logical volume:
# swapon -v /dev/VG1/LV1