Shrink VMs on virt-manager/KVM

  I tend to use rsync to backup my system ( including VMs) thanks an anoying bug[1] . Turns out, this would sync the entire sparse file, expanding from 11gb on disk to 64gb on target system.

 To "fix" this I now use qcow2 for disk image, based of instructions from here[2].

  •  Move existing images to qcow2 , if not done. This also would allow us to use snapshots via virt-manager [3]

  • Fill VMs with zeros to allow them to be compressed

  • Shut down the VMs, and run from host 

$ mv original_image.qcow2 original_image.qcow2_backup
$ qemu-img convert -O qcow2 original_image.qcow2_backup original_image.qcow2



Popular posts from this blog

phpipam behind a load balancer which handles ssl offloading

recovering LUKS encrypted Ubuntu LV Group when mounting on a different Ubuntu system