Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any way to shrink qcow2 image without converting it raw?

I cannot convert it to raw because I don't have disk space enough for raw image.

share|improve this question
add comment

2 Answers

try virt-sparcify - it will zerofill the unused blocks in the image and then deduplicate the zeroes

share|improve this answer
    
Thanks for you answer, but virt-sparcify said it cannot resize disk images and I found virt-resize from that, but looks like I still need to allocate spaces to expand (that I don't have enough spaces on my harddisk). Anyway, Thank you very much for you info. –  YOU Sep 27 '12 at 8:17
add comment

You can also try

qemu-img convert -c -O qcow2 source.qcow2 shrunk.qcow2

Before running above command be sure to shutdown the VM. After you are satisfied with the result, you can rename shrunk.qcow2 to original name your VM config wants.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.