Linux Administrator

How to Create Logical Volume for Swap

In my previous article I show you how you can safely remove your swap on Linux. As you know Swap is used when the amount of Random Access Memory (RAM) is full. Swap space is a portion of a hard disk drive (HDD) that is used for virtual memory.

In this article I will show you how to create Logical Volume (LV) for swap.

Create Logical Volume for Swap

Follow the below steps to create logical volume for swap.

1. First of all create the logical volume called “swap”

# lvcreate vg1 -n swap -L 6G

2. Format the new swap space.

# mkswap /dev/vg1/swap

3. Edit your /etc/fstab file and add the following entry.

# vim /etc/fstab
/dev/vg1/swap swap swap defaults 0 0

4. Now enable the swap using below command.

# swapon -va

Swap successfully created.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment