[virt-tools-list] Enabling qcow2 compression with virt-install
Paul Maunders
paul at fubra.com
Sun Aug 26 08:36:47 UTC 2012
> What are you trying to achieve? If you just want to make small guests
> (eg for a guest library for testing) then virt-sparsify is possibly
> the tool you want.
Yep, I was just try to make the guest images small for testing, but if
the performance was good then I would consider using in production
too.
I've given virt-sparsify a go, and it has recovered some space...
Before...
root at proliantml110:/var/lib/libvirt/images# du -h test-centos6-gpt.img.original
1.3G test-centos6-gpt.img.original
root at proliantml110:/var/lib/libvirt/images# qemu-img info
test-centos6-gpt.img.original
image: test-centos6-gpt.img.original
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.2G
cluster_size: 65536
Running virt-sparsify...
root at proliantml110:/var/lib/libvirt/images# virt-sparsify
test-centos6-gpt.img.original test-centos6-gpt.img.sparsified
Create overlay file to protect source disk ...
Examine source disk ...
Fill free space in /dev/vda1 with zero ...
Copy to destination and make sparse ...
Sparsify operation completed with no errors. Before deleting the old
disk, carefully check that the target disk boots and works correctly.
After ...
root at proliantml110:/var/lib/libvirt/images# du -h
test-centos6-gpt.img.sparsified
882M test-centos6-gpt.img.sparsified
root at proliantml110:/var/lib/libvirt/images# qemu-img info
test-centos6-gpt.img.sparsified
image: test-centos6-gpt.img.sparsified
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 882M
cluster_size: 65536
The benefits remained when compressing the sparsified image too...
root at proliantml110:/var/lib/libvirt/images# du -h
test-centos6-gpt.img.sparsified-compressed
289M test-centos6-gpt.img.sparsified-compressed
root at proliantml110:/var/lib/libvirt/images# du -h
test-centos6-gpt.img.original-compressed
369M test-centos6-gpt.img.original-compressed
So thanks for the tip!
I'm also going to experiment with backing images to build a base
library of gold images.
Cheers,
Paul
More information about the virt-tools-list
mailing list