2014-01-13

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

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1259829
[2] http://www.jamescoyle.net/how-to/323-reclaim-disk-space-from-a-sparse-image-file-qcow2-vmdk
[3] http://www.phoronix.com/scan.php?page=news_item&px=MTQ0NjM

No comments:

Post a Comment

GitLab runner on Windows with bash shell on windows contianer on Docker

As part of your pipeline, you may need to perform browser testing across different platforms/environments. To minimize testing time, it'...