Re: Storage image files and permissions

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

 



On Wed, Nov 28, 2018 at 03:05:29PM +0100, Vincenzo Romano wrote:
> Il giorno mer 28 nov 2018 alle ore 14:41 Eric Blake
> > > I doesn't make any real difference. It just puzzles me.
> >
> > The difference is whether you choose to preallocate an image. There are
> > performance tradeoffs for doing so (a preallocated image is faster than
> > a sparse one when it comes to writing to previously unused portions of
> > the disk, but occupies more host space as a result - also, a
> > preallocated image tends to have less fragmentation and less chance of
> > hitting ENOSPC).
> 
> Yes, but I've never seen (so far) a sparse QCOW file. After all, QCOW
> was introduced also to let users
> use file systems not supporting "sparse files".

qcow2 files can be sparse if you request it to preallocate metadata
only:

No preallocation -> small file size, small  allocation size:

  $ qemu-img create -f qcow2 demo.qcow2 1G
  Formatting 'demo.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16
  $ ls -alhs demo.qcow2 
  196K -rw-r--r--. 1 berrange berrange 193K Nov 28 14:07 demo.qcow2

Metadata prealloc -> full file size, small allocation size (ie sparse)

  $ qemu-img create -f qcow2 -o preallocation=metadata demo.qcow2 1G
  Formatting 'demo.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16
  $ ls -alhs demo.qcow2 
  328K -rw-r--r--. 1 berrange berrange 1.1G Nov 28 14:07 demo.qcow2

Full preallocate -> full file size, full allocation size:

  $ qemu-img create -f qcow2 -o preallocation=full demo.qcow2 1G
  Formatting 'demo.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 preallocation=full lazy_refcounts=off refcount_bits=16
  $ ls -alhs demo.qcow2 
  1.1G -rw-r--r--. 1 berrange berrange 1.1G Nov 28 14:08 demo.qcow2


qcow2 files also become sparse if you have support for discard and the
guest OS trims data blocks.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[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