KVM Storage Pools and Volumes: qcow2 vs raw Disk Images

Understand libvirt storage pools and volumes, compare qcow2 and raw images, and learn to create, resize, convert and back up KVM disks with qemu-img.

Published November 27, 2026

A virtual machine's disk is usually just a file on the host. How that file is formatted and where it lives affects performance, snapshots, backups and how much disk space you burn. libvirt organises these files into storage pools and volumes, and qemu-img is the tool for everything a pool cannot do.

The concept

A storage pool is a place libvirt can create disks in: a directory (the default pool is /var/lib/libvirt/images), an LVM volume group, an NFS export, an iSCSI target, a ZFS dataset or a Ceph RBD pool. A volume is one disk inside that pool. Pools let you say "give me a 40 GiB disk in the fast pool" without caring about paths.

The two image formats you will meet are raw and qcow2. Raw is a plain byte-for-byte disk image: simple and very fast, but snapshots and thin provisioning depend on the underlying filesystem. qcow2 (QEMU Copy-On-Write v2) adds features in the format itself: thin provisioning, internal and external snapshots, backing files, compression and encryption.

raw vs qcow2

Featurerawqcow2
PerformanceBest, no metadata lookupsVery close with preallocation=metadata
Thin provisioningOnly as a sparse fileBuilt in
SnapshotsVia LVM/ZFS/filesystemInternal and external snapshots
Backing files (linked clones)NoYes
Compression / encryptionNoYes (LUKS encryption)
PortabilityUniversalQEMU ecosystem (convertible)

Backing files and copy-on-write

backing filecopy-on-writebase.qcow2read-onlyvm1.qcow2overlayVM writesonly diffs
An overlay stores only the blocks the VM changes.

Performance in practice

raw on NVMe100% baselineqcow2 prealloc≈97%qcow2 sparse≈88% while growingqcow2 + 5 snapshots≈80%
Illustrative relative random-write throughput; measure on your own hardware with fio.

Working with pools

virsh pool-list --all
Name State Autostart
default active yes
virsh vol-create-as default db01.qcow2 40G --format qcow2
Vol db01.qcow2 created
qemu-img info /var/lib/libvirt/images/db01.qcow2
file format: qcow2
virtual size: 40 GiB (42949672960 bytes)
disk size: 196 KiB
A 40 GiB thin volume uses almost no space until data is written.

Practical examples

Create a directory pool on a second disk

Point libvirt at a faster or larger mount.

virsh pool-define-as fast dir --target /mnt/nvme/vms
virsh pool-build fast && virsh pool-start fast && virsh pool-autostart fast

Grow a disk

Resize the image, then grow the partition and filesystem inside the guest.

virsh blockresize web01 vda 60G          # live, VM running
# or offline: qemu-img resize web01.qcow2 +20G
# inside the guest:
sudo growpart /dev/vda 1 && sudo resize2fs /dev/vda1

Convert between formats

Handy when importing VMware or VirtualBox disks.

qemu-img convert -p -f vmdk -O qcow2 appliance.vmdk appliance.qcow2
qemu-img convert -p -O raw web01.qcow2 web01.raw
qemu-img convert -c -O qcow2 web01.qcow2 web01-compressed.qcow2

Common mistakes

  • Running qemu-img on a disk that a running VM is using. This can corrupt it; use -U only for read-only info, or shut the VM down.
  • Deleting a base image that overlays depend on. Every linked clone breaks.
  • Over-provisioning thin disks until the host filesystem fills up and every VM pauses with an I/O error.
  • Shrinking a qcow2 without shrinking the guest filesystem first.
  • Using cache=unsafe outside throwaway test VMs.

Key takeaways

  • Pools are where disks live; volumes are the disks.
  • Choose raw for maximum simplicity and speed and qcow2 for snapshots, thin provisioning and clones.
  • qemu-img handles create, info, resize, convert and check.
  • Watch host free space when using thin-provisioned disks.

FAQ

Which cache mode should I use?

cache=none with io=native (or io_uring) is the usual production choice: it bypasses the host page cache and is safe with O_DIRECT.

How do I reclaim space after deleting files in the guest?

Enable discard (discard=unmap on a virtio-scsi or virtio-blk disk), then run fstrim in the guest. The qcow2 file will shrink holes back.

Can I use LVM instead of files?

Yes, define a logical pool on a volume group. Each VM disk becomes an LV, which is fast and integrates with LVM snapshots.

More Linux articles