Use this when using QEMU's qcow2 format.
QCOW2
QCOW2 is QEMU's copy-on-write disk format with thin provisioning, internal and external snapshots, backing files and optional compression. It is flexible, but slightly slower than raw.
1. qcow2: thin, snapshots, backing files.
2. preallocation=metadata improves write performance.
3. cluster_size 64K default.
4. Check after crashes.
5. Avoid long backing chains.
qcow2 → QEMU block layer → guest
Context & applicabilityCommon mistakes · platform/version boundaries
- Internal snapshots on large images slowing I/O; use external snapshots or backup tools.
- Not preallocating metadata for performance-sensitive disks (
-o preallocation=metadata). - Copying images while the VM runs.
- Images not trimmed — enable
discard='unmap'and TRIM in the guest.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Thin, snapshots, backing files.
- Slower than raw.
- Check with qemu-img check.
qemu-img info <disk.qcow2>— format/backingqemu-img check <disk.qcow2>— consistencyqemu-img convert -O qcow2 -o preallocation=metadata src dst— preallocated metadata
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
QCOW2 is QEMU's copy-on-write image format: thin allocation, internal and external snapshots, backing files for linked clones, compression and encryption.
qemu-img create -f qcow2 -o cluster_size=64k,preallocation=metadata vm.qcow2 100G
qemu-img info --backing-chain vm.qcow2
qemu-img check vm.qcow2
qemu-img resize vm.qcow2 +50G
qemu-img convert -O qcow2 -c old.qcow2 compact.qcow2
On CoW storage such as ZFS or Btrfs, qcow2 adds a second CoW layer — raw images or zvols are usually faster there. preallocation=metadata avoids metadata allocation overhead on first writes.
Features
| Feature | Command / option |
|---|---|
| Backing file (linked clone) | qemu-img create -f qcow2 -b base.qcow2 -F qcow2 clone.qcow2 |
| Compression | qemu-img convert -c -O qcow2 in.qcow2 out.qcow2 |
| Encryption (LUKS) | -o encrypt.format=luks |
| Internal snapshots | qemu-img snapshot -c snap1 disk.qcow2 |
| Resize | qemu-img resize disk.qcow2 +20G |
ReferenceConfiguration & state1 section · depth on demand
Commands
qemu-img create -f qcow2 vm01.qcow2 100G
qemu-img create -f qcow2 -b base.qcow2 -F qcow2 vm02.qcow2 # backing file
qemu-img snapshot -l vm01.qcow2
qemu-img check vm01.qcow2
qemu-img convert -O qcow2 -c vm01.qcow2 vm01-compact.qcow2
Documented example, not captured output. Pre-allocating metadata (-o preallocation=metadata) improves write performance. Long backing chains slow I/O; commit or flatten them (virsh blockcommit / blockpull).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Hypervisor Storage → KVM Storage → QCOW2. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://pve.proxmox.com/pve-docs/chapter-pvesm.html · confidence 94%