Step To Create LVM (Logical Volume Manager) on Linux

Step To Create LVM (Logical Volume Manager)

Step To Create LVM (Logical Volume Manager) is basically used for resizing the file systems. We can simply add a disk to the systems and can create an LVM partition with this method. To accomplish, we need physical volume, volume group. We can create and check lvm partition using fdisk in Linux.

Physical Volume: This is a small disk partition we do cut from the raw disk available on the system like dev/sd{b1,b2,b3..} and so on.

Volume Group: This is a combination of physical volume which makes a volume group that helps us to create an LVM partition. If we require extra space to add in LVM, just increase the size in the Volume group then extend the LVM partition.

Check Out: Resizing LVM Partition

Note: when you format a disk with file system keep remember you use the same file system to format the disk-like xfs and ext4.

In the same way, create a partition

create lvm partition

We have created partition /dev/sdb2 and /dev/sdb3.

lvm create linux

Now create Physical Volume with /dev/sdb2 and in the same way do with /dev/sdb3

pvcreate /dev/sdb2

create lvm in linux

pvcreate /dev/sdb3

Check Out: Error Locate Command Not Found (find files) In Linux

If you want to check the physical volume created.

pvdisplay

Now you have to create a volume group and it will come both physical volume.

Check Out: How To Mount Same Volume To Multiple Container In Docker

vgcreate vg_test /dev/sdb2 /dev/sdb3

vgdisplay

We can use the below command to create LVM.

lvcreate -n lv_test --size 3M vg_test

To check the volume group created,

vgs

Now LVM created

Check Out: Mount LVM Partition On a Directory

Now you have to format this partition.

mkfs.ext4 /dev/mapper/vg_test-lv_test

Make a directory and edit fstab entry.

vim /etc/fstab

Run the command to check any issue in mounting using mount –a

how to check lvm partition in linux

Now check disk will be added.

df –TH

linux resize lvm partition without losing data

YouTube Link: Create LVM on Linux

You’re done create lvm in linux fdisk check

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment