====== Shrink Qcow2 Disk Files ======
===== Linux Guest Preparation =====
Use the following command to zero out your disk (inside the VM):
# dd if=/dev/zero of=/mytempfile
# rm -f /mytempfile
===== Shrink the Disk File =====
Shut down the VM.
Create a backup of your existing VM disk file:
# mv image.qcow2 image.qcow2_backup
There are 2 options, one with compression and another without.
==== Option #1: No Compression ====
# qemu-img convert -O qcow2 image.qcow2_backup image.qcow2
==== Option #2: With Compression (performance impact on slower systems) ====
# qemu-img convert -O qcow2 -c image.qcow2_backup image.qcow2
Boot your VM and verify all is working.