[libvirt-users] preallocation=full Vs preallocation=metadata

Jatin Davey jashokda at cisco.com
Wed Jun 3 12:44:01 UTC 2015


Thanks Kashyap.

I will test with option 2 & 3 and use whichever gives better results.

Thanks
Jatin

On 6/3/2015 1:08 PM, Kashyap Chamarthy wrote:
> On Tue, Jun 02, 2015 at 09:14:03AM +0530, Jatin Davey wrote:
>> Hi All
>>
>> I was reading through this:
>>
>> http://kashyapc.com/2011/12/02/little-more-disk-io-perf-improvement-with-fallocateing-a-qcow2-disk/
> In my testing, the above method gives near-raw performance as it
> preallocated all the space ahead of time.
>
> The above test can now be done in a single command -- see option (3)
> below.
>
>> I was basically searching for pointers on improving disk I/O.
>>
>> I wanted to know the purpose of preallocation=full & preallocation=metadata >
>>
>> , What is the difference between them ? and which one would yield a better
>> disk I/O speed ?
> There are three options that modern `qemu-img` supports:
>
> (1) 'preallocation=metadata': allocates qcow2 metadata, and it's still
>      a sparse image.
>
>      $ qemu-img create -f qcow2 -o preallocation=metadata test1-metadata.qcow2 1G
>      Formatting 'test1-metadata.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off refcount_bits=16
>      328K -rw-r--r--. 1 root root 1.1G Jun  3 03:20 copy-test1-metadata.qcow2
>
> (2) 'preallocation=full': allocates zeroes and makes a non-sparse image.
>
>      $ qemu-img create -f qcow2 -o preallocation=full test2-full.qcow2 1G
>      Formatting 'test2-full.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 preallocation='full' lazy_refcounts=off refcount_bits=16
>      $ ls -lash test2-full.qcow2
>      1.1G -rw-r--r--. 1 root root 1.1G Jun  3 03:31 test2-full.qcow2
>
> (3) 'preallocation=falloc': which uses posix_fallocate() to "allocate
>      blocks and marking them as uninitialized", and is relatively faster
>      than writing out zeroes to a file:
>
>      $ qemu-img create -f qcow2 -o preallocation=falloc test3-falloc.qcow2 1G
>      Formatting 'test3-falloc.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 preallocation='falloc' lazy_refcounts=off refcount_bits=16
>      $ ls -lash test3-falloc.qcow2
>      1.1G -rw-r--r--. 1 root root 1.1G Jun  3 03:32 test3-falloc.qcow2
>
> You can test and compare between (2) and (3) what works best for you.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20150603/663dcee7/attachment.htm>


More information about the libvirt-users mailing list