When I do the below then the qcow2 file is less than 200KB.

# qemu-img create -f qcow2 /var/lib/libvirt/images/urb-dat0.qcow2 10G
# du -hsc /var/lib/libvirt/images/urb-dat0.qcow2
196K    /var/lib/libvirt/images/urb-dat0.qcow2

If I attach it to a KVM guest and fdisk -l

Disk /dev/vdb: 0 MB, 197120 bytes, 385 sectors


How to make a 10GB qcow2 file that is not thin provisioned?

2 Answers 2


You can use the preallocation option.

qemu-img create -o preallocation=full -f qcow2 /var/lib/libvirt/images/urb-dat0.qcow2 10G

Reference: https://linux.die.net/man/1/qemu-img

Preallocation mode (allowed values: off, metadata, full). An image with preallocated metadata is initially larger but can improve performance when the image needs to grow. Full preallocation additionally writes zeros to the whole image in order to preallocate lower layers (e.g. the file system containing the image file) as well. Note that full preallocation writes to every byte of the virtual disk, so it can take a long time for large images.

  • That worked =) What is the purpose of the thin provisioned qcow2 file when it can't be used for a filesystem inside a guest? Mar 29, 2017 at 7:58
  • @JasmineLognnes what makes you think you can't use a thin provisioned file for a guest FS?
    – dyasny
    Mar 29, 2017 at 10:11
  • 1
    From the output I got from fdisk -l and I even tried to do mkfs.btrfs /dev/vdb which failed. Mar 29, 2017 at 10:38
  • 2
    I may have attached the qcow2 images as raw, which could explain why it didn't worked... Mar 29, 2017 at 11:21

An existing thin-provisioned qcow2 file can be converted to a fully allocated one like this:

qemu-img convert -p -f qcow2 -O qcow2 -S 0 original-file.qcow2 new-file.qcow2

(This is not an answer to the question but might still be of interest.)

  • It may be noted that this command can be quite slow. Fully allocating a 340GB disk with 11GB used data took more than 30 minutes on a modern server on a spinning disk.
    – emmenlau
    Sep 12 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .