0

shrink sparse qcow2 file

When a vm’s been running for a while the sparse file will get bigger and bigger. If a cleanup has been done and the space usage is back down to minimal the sparse file will remain the largest size it was before. you can shrink the sparse file back down to minimal space usage by issuing the following.

Please note that VM should be off during this.


mv myqcow2file.qcow2 myqcow2file.qcow2.bak
qemu-img convert -O qcow2 myqcow2file.qcow2.bak myqcow2file.qcow2

start up the VM and everything should be back to normal and the space of the sparse qcow2 file should be much less.

jlim0930

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.