KVM - resize qcow2

April 24, 2019 in linux ‐ 1 min read

To resize the qcow2 image of a KVM Virtual Machine there is an easy command line tool. First shut down the VM and check where the qcow image is located.

Using the virt-manager go to view > details > highlight the hard drive > source path

image

On the comand line you can check virsh edit <VM NAME> to open the XML descriptor file where the qcow is located.

image

Now you can resize it using the following command.

qemu-img resize path_to_.qcow +??G

In my case this would be:

sudo qemu-img resize /var/lib/uvtool/libvirt/images/vm_haproxy.qcow +20G

If you now start the vm, you can take a look at df -h to find that it worked. Also it should be quite clear in the Monitoring, in case you monitor the vm.

image

Cheers, Ori