KVM | Expanding the Guest VM Disk Images

Опубликовано: 15 Октябрь 2024
на канале: Yogesh Mehta
6,943
55

This one of BAU task for systems admins to expand the disk sizes. As we have picked qcow2 as our image format which is most flexible and very low filesystem overheads and stable disk format for KVM guests . We will use the qemu-img utility to resize the disk.

In this LAB testvm1-os.qcow2 is the OS disk we are going to expand by 01GB.

First check the storage pools used by the KVM.
virsh pool-list

In our case we are using ‘lab_kvm_storagepool’ as storage pool to store the kvm guest images.
virsh vol-list lab_kvm_storagepool

Check the details of the image ..
virsh vol-info /var/lib/libvirt/images/testvm1-os.qcow2

Expand the disk
qemu-img resize /var/lib/libvirt/images/testvm1-os.qcow2 +1G

Check the volume properties to ensure resize is completed.
virsh vol-info /var/lib/libvirt/images/testvm1-os.qcow2

After this you have to perform the OS level changes configuring the disk resizing, such as fdisk/lvm stuff.

Watch the video for details: