Online Resizing of KVM drive

Don’t try to resize a disk of a running VM with qemu-img directly. Use virsh instead. NB: This can’t be done via the GUI, either. You have to use the shell.

Gather info:

virsh # domblkinfo <domain> --all --human

Resize virtual disk:

virsh # blockresize <domain> --path <vd?> --size 300GB

Then inside the VM, assuming you’re using LVM and XFS as filesystem, re-read the partition table of the resized disk, then resize the physical volume, then the logical volume and finally the filesystem:

# blockdev --rereadpt /dev/vd?
# pvresize /dev/vd?
# lvextend -l +<no. of extends> /dev/mapper/<lv-name>
# xfs_growfs /dev/mapper/<lv-name>

That’s all, folks!