Expanding a VM’s storage is a routine operation in KVM environments. The process has two distinct phases: expanding the raw disk capacity and then growing the partitions and filesystems to use that space.
Resizing the Disk Image
The first step is to increase the virtual disk size using qemu-img:
qemu-img resize disk.qcow2 +10G
This adds 10GB to the image. You can also specify an absolute size:
qemu-img resize disk.qcow2 50G
For raw image files, the syntax is identical:
qemu-img resize disk.raw +20G
The VM must be shut down before resizing. If you attempt to resize a disk while the guest is running, qemu-img will refuse with an error unless you use the --shrink flag (which is dangerous and rarely needed).
You can check the current size of an image before resizing:
qemu-img info disk.qcow2
Growing Partitions and Filesystems
After resizing the image, shut down the guest and boot it back up. The new space won’t be available until the guest’s partition table and filesystem are expanded.
Using virt-resize (Recommended)
For qcow2-backed VMs, virt-resize from the libguestfs-tools package handles partition and filesystem expansion in one step without needing to boot the guest:
virt-resize --expand /dev/sda3 disk.qcow2 disk-resized.qcow2
This expands the last partition (/dev/sda3) to fill available space. You can then replace the original image:
mv disk-resized.qcow2 disk.qcow2
virt-resize works offline, making it safer for production VMs. It handles most common filesystem types automatically.
Manual Expansion Inside the Guest
If you prefer to expand partitions manually or are working with LVM/Ceph-backed disks, boot the guest and resize from inside:
For ext4:
sudo fdisk /dev/sda
# Delete the partition, recreate it with larger size, save and exit
sudo resize2fs /dev/sda3
Or use parted for non-destructive resizing:
sudo parted /dev/sda
(parted) resizepart 3 100%
(parted) quit
sudo resize2fs /dev/sda3
For XFS:
sudo parted /dev/sda
(parted) resizepart 3 100%
(parted) quit
sudo xfs_growfs /
XFS can grow while mounted, so you don’t need to unmount.
For LVM:
If your guest uses LVM, expand the physical volume first:
sudo pvresize /dev/sda3
sudo lvextend -l +100%FREE /dev/vg0/lv_root
sudo resize2fs /dev/vg0/lv_root
Storage Backend Considerations
qcow2 files: Use the commands above directly.
Raw images: qemu-img resize works the same way. virt-resize also supports raw images.
LVM-backed disks: Resize the logical volume instead:
sudo lvresize -L +10G /dev/vg0/vm-disk
Then grow the guest’s filesystem as shown above.
Ceph RBD images: Expand the RBD volume:
rbd resize --size 50G pool/image-name
Then resize the guest filesystem.
Verification
After resizing, verify the changes:
df -h
lsblk
parted /dev/sda print
If you resized LVM or Ceph, also check:
pvs
lvs
Watch for any filesystem or partition errors. Most modern filesystems handle online growth well, but always keep backups of important VMs before major storage operations.

The right answer is:
cp kvm1.qcow2 kvm1-orig.qcow2
qemu-img resize kvm1.qcow2 +20G
virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2
First copy, second resize the new image, third resize partition.
How to expand a kvm .img with only one reboot:
qemu-img resize {/smnt/virt/images/name.img} +size (k, M, G or T)
virsh qemu-monitor-command {VM-name} info block –hmp (Capture the drive-virtio-disk number, usually 0)
virsh qemu-monitor-command {VM-name} block_resize drive-virtio-disk# [new size k, M, G or T] –hmp
lsblk should show the updated size of /dev/vda
dmesg {system picks up updated size}
delete and recreate vda3 using fdisk /dev/vda (c, u, d, 3, w) (c, u, n, p, 3, {default}, {default}, w)
reboot VM, need to reboot the KVM to update the kernel of the new partition size. Parted will not update the kernel because the volumes are mounted, remounting without reboot will not update the kernel.
lsblk should show updated size of partition
resize2fs /dev/vda3