libvirt - The virtualization API
Compress qcow2 image
# on guest system
dd if=/dev/zero of=zerofile bs=1M; rm zerofile
# on host system
qemu-img convert -p -c -O qcow2 example.qcow2 example-copy.qcow2
# on guest system
dd if=/dev/zero of=zerofile bs=1M; rm zerofile
# on host system
qemu-img convert -p -c -O qcow2 example.qcow2 example-copy.qcow2