How to Create a Volume Group with LVM on Ubuntu Linux

e commerce 1606962 640
e commerce 1606962 640

This brief tutorial shows students and new users how to use Linux Logical Volume Management (LVM) to create a volume group from your physical volumes.

When it comes to creating volume groups from multiple hard disk drives, Volume Group (VG) is the key to that process.

VG is the architecture that allows you to combine multiple physical volumes to create a single storage structure, that is equal to the storage capacity of the combined physical devices.

The physical volume devices are initialized using LVM.

For example, if you take two physical 1GB hard drive disks and combine them to create a volume, you’ll end up with 2GB storage capacity, representing the two disks.

To get started with creating logical volumes on Ubuntu, follow the steps below:

Install LVM2 Package

To create logical volume groups by combining multiple disks, you must first install the LVM2 package. By default, it doesn’t come installed in Ubuntu.

To install, run the commands below:

sudo apt update
sudo apt install lvm2

That should install the LVM2 package on Ubuntu

Create a Logical Volume Group

After installing the LVM2 package, continue below to create your first logical volume group.

First list the physical drives on the machine. You can do that by running the commands below:

sudo pvs -a

The command above will list all the disks available on the system. A similar screen below should appear on your console.

PV VG Fmt Attr PSize PFree
/dev/loop0 --- 0 0
/dev/loop1 --- 0 0
/dev/loop2 --- 0 0
/dev/loop3 --- 0 0
/dev/loop4 --- 0 0
/dev/loop5 --- 0 0
/dev/loop7 --- 0 0
/dev/sda1 --- 0 0
/dev/sdb --- 0 0
/dev/sdc --- 0 0

For this tutorial, we will be combing /dev/sdb and /dev/sdc and calling our logical volume group LVMSDBSDCBlk using the vgcreate command.

To do that, run the commands below:

sudo vgcreate LVMSDBSDCBlk /dev/sdb /dev/sdc

After running the commands above, you should get a success message similar to the one below:

Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
Volume group "LVMSDBSDCBlk" successfully created

After creating the volume group, you can list it using the command below:

sudo pvs

It should then list the newly created volume group similar to the one below:

PV VG Fmt Attr PSize PFree
/dev/sdb LVMSDBSDCBlk lvm2 a-- 1020.00m 1020.00m
/dev/sdc LVMSDBSDCBlk lvm2 a-- 1020.00m 1020.00m

That’s it!

Conclusion:

You have learned how to create a logical volume group on Ubuntu using the LVM2 command. To create logical volumes, you’ll need to use the lvcreate command.

We’ll explore how to create new volumes from the group we created above using the lvcreate command.

Until then, enjoy!

You may also like the post below:

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: