Linux VPS

qcow2 vs raw: choosing a KVM disk image format

Compare qcow2 and raw virtual disk formats for KVM: performance, thin provisioning, snapshots, and how LVM, ZFS and Ceph change the picture, with qemu-img commands to convert and resize.

IntermediateKVM hosts2 min read

A KVM virtual machine stores its disk either in a file or on a block device. The two common file formats are qcow2 vs raw, and the choice affects speed, disk usage and how snapshots work. This guide explains the differences and the storage options behind them.

Before you start

  • A KVM host with qemu-utils (Debian/Ubuntu) or qemu-img (RHEL family) installed.
  • Shut a VM down before converting or resizing its disk.

qcow2 vs raw at a glance

qcow2raw
Thin provisioningYes, grows as data is writtenSparse files only (filesystem dependent)
Internal snapshotsYesNo
Backing files / linked clonesYesNo
Compression and encryptionOptionalNo
PerformanceVery close to raw with preallocation=metadataFastest, no metadata layer
PortabilityGood for copying and templatesSimple, readable by any tool

When to use qcow2

  • You want snapshots or templates with linked clones.
  • You overcommit storage and want disks to grow only as used.
  • You copy images between hosts and want them small.

When to use raw

  • Maximum, predictable I/O for databases.
  • The storage layer already offers snapshots and thin provisioning, such as LVM-thin, ZFS zvols or Ceph RBD. Adding qcow2 on top would duplicate features and add overhead.

Block storage instead of files

  • LVM: each VM gets a logical volume. Fast and simple; LVM-thin adds thin provisioning and snapshots. See LVM basics.
  • ZFS: zvols with checksums, compression and instant snapshots; needs plenty of RAM.
  • Ceph RBD: distributed storage across nodes, enabling live migration without shared NFS.

Panels like Virtualizor and VirtFusion support several of these; see VirtFusion storage options and Virtualizor LVM-thin storage.

Useful qemu-img commands

Inspect an image:

qemu-img info /var/lib/libvirt/images/web01.qcow2

Create a qcow2 disk with metadata preallocation:

qemu-img create -f qcow2 -o preallocation=metadata disk.qcow2 50G

Convert raw to qcow2:

qemu-img convert -p -O qcow2 disk.raw disk.qcow2

Grow a disk by 20 GB (then extend the partition and filesystem inside the guest):

qemu-img resize disk.qcow2 +20G

Troubleshooting

  • Host disk full though VMs look small: thin qcow2 images grew; monitor real usage with du -h, not apparent size.
  • "Could not open... Permission denied": check ownership and AppArmor/SELinux labels on the image path.
  • Slow qcow2 writes: use cache=none, io=native and virtio-scsi or virtio-blk.

Frequently asked questions

Is raw always faster than qcow2?

Slightly, but on modern QEMU the difference is small for most workloads. The underlying disk (NVMe vs HDD) matters far more.

Can I shrink a qcow2 image?

Run fstrim in the guest with discard enabled, or rewrite the image with qemu-img convert to reclaim unused space.

What format do VPS providers use?

It varies: many use LVM or ZFS block devices with raw volumes, others qcow2 files on local NVMe.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.