Hi all,

With this post, I want to explain how to increase LVM disk size that exist on linux server on “KVM virtualization”. I will resize image on KVM and then increase size of “/home” partition.

Resize Image

Firstly, I will resize image (.qcow2 file) with this command that below:

Usage:

cd "path_of_img"
qemu-img resize "img_name".qcow2 +"size_to_be_increased"G

For me:

cd /SSD2/QCOWs
qemu-img resize MBs-TST.qcow2 +150G

At above code, I increased “MBs-TST.qcow2” with “150GB”.

Disk Usage for "/home" Directory
root > df -lh | grep /home

Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/ol-home   62G   44G   18G  71% /home

List Disks
root > ls /dev/vd*

/dev/vda  /dev/vda1  /dev/vda2

Check Volume Group for Free Size
root > vgdisplay

VG Name               ol
VG Size               119.00 GiB
Free  PE / Size       1 / 4.00 MiB

Create Partition Table
root > fdisk /dev/vda

(n, p, ENTER, ENTER, w)

Reboot the Server
root > reboot

List Disks again
root > ls /dev/vd*

/dev/vda  /dev/vda1  /dev/vda2  /dev/vda3

Extend Volume Group
root > vgextend ol /dev/vda3

Check Volume Group for Free Size again
root > vgdisplay

VG Name               ol
VG Size               268.99 GiB
Free  PE / Size       38400 / 150.00 GiB

Extend Logical Volume ("ol-home") with all Free Space
root > lvextend -l +100%FREE /dev/mapper/ol-home

Commit Changes (Grows the "/home")
root > xfs_growfs /home

Check Directory ("/home")
root > df -lh | grep /home

Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/ol-home  212G   44G  168G  21% /home

I increased “/home” partition with “150GB” that added to server on KVM.