Virt-sparsify
While doing virsh migrate on VM (same subnet), I have run into situation where the destination disk copied is larger than the source.
Example:
This was also seen when I had to just do a backup/create custom qcow2 images for my eve-ng labs.
For virsh migrate --sparse option can be used while migrating live VMs.
If the VM disks were copied over scp, rsync we can use virt-sparsify to reclaim unused disk space.
root@eve-lab:~# du -sch rhel8.10-2025-12-29.qcow2
23G rhel8.10-2025-12-29.qcow2
23G total
root@eve-lab:~# qemu-img info rhel8.10-2025-12-29.qcow2
image: rhel8.10-2025-12-29.qcow2
file format: qcow2
virtual size: 22 GiB (23622320128 bytes)
disk size: 22 GiB
cluster_size: 65536
cleanly shut down: no
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: true
refcount bits: 16
corrupt: false
extended l2: false
Run virt-sparsify:
root@eve-lab:~# virt-sparsify rhel8.10-2025-12-29.qcow2 rhel8-sparse.qcow2
Verify result:
root@eve-lab:~# du -sch rhel8.10-2025-12-29.qcow2
23G rhel8.10-2025-12-29.qcow2
23G total
Related Articles
Virt-sparsify
How to use virt-sparsify to reclaim unused disk space from qcow2 VM images.
How We Set Up Our KVM Hypervisor: From Bare Metal to Production-Ready VM Host
Detailed walkthrough of building a dedicated KVM/libvirt hypervisor with XFS tuning, hugepages, 10GbE tuning, and automation.
Building a Predictable KVM Infrastructure: From Chaos to Control
How to engineer a predictable KVM-based infrastructure focusing on repeatability, observability, and operational safety.