Re: Enabling qcow2 compression with virt-install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 26, 2012 at 09:36:47AM +0100, Paul Maunders wrote:
> root@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@proliantml110:/var/lib/libvirt/images# du -h
> test-centos6-gpt.img.sparsified
> 882M	test-centos6-gpt.img.sparsified
> 
> root@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@proliantml110:/var/lib/libvirt/images# du -h
> test-centos6-gpt.img.sparsified-compressed
> 289M	test-centos6-gpt.img.sparsified-compressed
> root@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.

A couple of points:

(1) Since libguestfs 1.15.6, virt-sparsify has supported a --compress
option.  If you use '--convert qcow2 --compress' then this generates a
compressed qcow2 file directly.

(2) I don't use this option for my guest library.  Instead I use raw
sparse output and then 'xz --best' to compress the final image.  Of
course such an image isn't directly runnable, however xz does produce
extremely small images, at the cost of taking a very long time to
compress them.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux