recreate LVM partition

Resizing LVM Partition On Redhat/Cent0s 7

If you do not know how to create LVM partition on Linux, so you can learn it from here is the link of our previous post about LVM

Check Out Mount LVM Partition

Check Out LVM Creation

I’m assuming you have already created or having partition on your Linux Machine.

As you can see I have created a 3 new partition of size 500mb , 400mb and 200mb from existing physical volume size of 2GB.

Run partprobe /dev/sdb

We have created Physical Volume of three partition

pvcreate /dev/{sdb1,sdb2,sdb3}

Now we have created Volume group vg0 from Physical Volume

vgcreate vg0 /dev/{sdb1,sdb2,sdb3}

Now we have to create a Logical Volume lv0 and then we will extend the size

lvcreate –name lv0 –size +2G vg0

You can check LVM details by command vgs

Format the LVM Partition

mkfs.ext4 /dev/mapper/vg0-lv0

I have mounted the LVM into the fstab for permanent mount

Now extend the partition +100MB

lvextend -L +100M /dev/vg0/lv0

Now resize the size of partition using below command

resize2fs /dev/vg0/lv0

Last Step is to check the size of partition by command df –h

Before the size of /dev/vg0/lv0 was 2.0G now it’s 2.1G after increasing the 100MB.

Note: If you want to format the file system with xfs, the command is xfs_growfs  {filesystem}

You’re done

Sponsored

LEAVE A REPLY

Please enter your comment!
Please enter your name here