linux expand disk partition

Follow the step to resizing LVM, 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. We can resize and expand disk partition LVM volume in Linux.

Step To Resizing LVM Partition:

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

Check Out: Mount LVM Partition On a Directory

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

how to increase disk space in linux

partprobe /dev/sdb

We have created Physical Volume of three partition

pvcreate /dev/{sdb1,sdb2,sdb3}

how to increase filesystem size in linux

Now we have created Volume group vg0 from Physical Volume

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

Check Out: Create LVM (Logical Volume Manager)

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

lvcreate --name lv0 --size +2G vg0

step to resizing lvm

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.

Check Out: Step By Step Increase Existing Swap Partition Using Disk Partition

Now extend the partition +100MB

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

resize lvm

Now resize the size of the partition using below command

resize2fs /dev/vg0/lv0

resize lvm volume

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

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

linux resize volume partition

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

You’re done resize lvm volume partition expand disk  linux 

LEAVE A REPLY

Please enter your comment!
Please enter your name here