LVM Disk Management on Manjaro Linux

On this tutorial I will show you how to create a Logical Volume using several disks. LVM (Logical Volume Management) is a powerful way to manage multiple disks under Linux. We can use any number of disks as on big disks. The system will see those disks as single disk. For more information you may want to read more about LVM.

Steps to create Logical Volume on Manjaro Linux

Step 1. Create Physical Volume
Step 2. Create Volume Group
Step 3. Create Logical Volume

Step 1. Create Physical Volume

Physical volume can consist of many hard disks or partitions. We can add or remove disks from the physical volume. To create a new physical volume you will need one or more hard disks connected to Manjaro. Check the disk using fdisk -l or lsblk command.
lsblk
Output
As you can see here, I have sdb and sdc as my additional hard drive that is not in use. We will create a new PV with these hard disks. On this tutorial, the entire hard disks will be used for LVM. So, I don't have to create new partitions on it.
pvcreate /dev/sdb /dev/sdc
Output
OK now, new physical volume is ready. Make sure there are no error when executing the command above. We can continue to the next steps.

Verify the new Physical Volume
pvdisplay
Output:
Alternatively we can also use pvs command.
pvs
Output:

Step 2. Create Volume Group

Now we can create a new volume group. Volume group contains one or more physical volume. For example, we will create a new volume group called VGTest. I will add /dev/sdb to this VGTest.
vgcreate VGTest /dev/sdb
Output
Check the new volume group
vgs
Output
or use vgdisplay for detailed information about the volume group on system
vgdisplay
Output
Extend Volume Group
In some cases we need to extend or increase the size of a volume group by adding more physical volumes. Here I will extend my previously created VGTest with /dev/sdc. We use vgextend command as follow.
vgextend VGTest /dev/sdc
Output
Check the new volume group status
vgs
Output
As you can see, VGTest now has 14.99 gigabyte in size after I added /dev/sdc (10 GB) to this VGTest.

Step 3. Create Logical Volume

Now we can start to create a new Logical volume. For example, I want to create a logical volume with 7 GB in size. I would use the following command:
lvcreate -L 7G -n project VGTest
The command will create a new logical volume called project inside VGTest Volume Group with 7 GB in size. You can adjust the parameter to meet your own needs.
After created a new logical volume, we can then mount and format this logical volume.
Thanks for reading, please follow this blog to get more articles like this. Cheers.


EmoticonEmoticon