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:

GeekBuying.com
# 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

 

Leave a Reply

Your email address will not be published. Required fields are marked *