Resize QCOW2 disk image
QCOW2 disk images can be easily grown using libvirt command line utils.
Unfortunately it isn’t possible to grow QCOW2 images in-place or online.
First of all, power off the virtual machine, grow the file and make a copy of
it:
$ qemu-img resize image.qcow2 +200G
$ cp image.qcow2 image-new.qcow2
Identify the specific partion you intend to grow:
$ virt-filesystems -a image.qcow2 -l
Name Type VFS Label Size Parent
/dev/sda1 filesystem ext4 - 536870912 -
/dev/sda3 filesystem xfs - 45885612000 -
Expand the actual partition:
$ virt-resize --expand /dev/sda3 image-new.qcow2 image.qcow2
Use qemu-img to check that the image is actually 200 GB bigger:
$ qemu-img info image.qcow2
Boot up the VM and grow the XFS filesystem, in my case I wanna grow /dev/sda3 which is mounted as root FS:
$ xfs_growfs /