# QCOW2 (QEMU Copy-On-Write version 2)

> QEMU's native disk image format, and the usual working format for Linux VM image builds.

**QCOW2** is the disk image format used by **QEMU** (Quick Emulator, the open-source machine emulator and virtualizer that underpins most Linux virtualization), and therefore the format most Linux image builds naturally produce. Its defining property is that it is **sparse**: the file only allocates space for blocks that have actually been written, so a 50 GB virtual disk holding 3 GB of data is a roughly 3 GB file. It also supports internal snapshots, backing files (a thin overlay on a shared base image), and compression.

Those features make it a good *working* format and a poor *distribution* format. No major cloud imports QCOW2 directly. Publishing a QCOW2-built image means converting it to what each destination expects:

- **AWS** — RAW, an unstructured byte-for-byte disk dump (or VHD/VMDK) for [AMI](https://primcoat.app/glossary/ami) import
- **Azure** — a fixed-size VHD (Virtual Hard Disk, Microsoft's format), whose virtual size must be a whole number of MiB
- **Google Cloud** — a RAW disk, tarred and gzipped
- **Hyper-V** — VHDX, the successor to VHD and the only format a Generation 2 (UEFI) virtual machine will boot
- **VMware** — VMDK (Virtual Machine Disk, VMware's own format)

The conversion is mechanical, usually a `qemu-img convert`, but the destination-specific constraints are where builds break. Azure's fixed-VHD alignment requirement in particular rejects images that are correct in every other respect, and the failure surfaces at upload time rather than at build time.

## Related

- https://primcoat.app/glossary/ami.md
- https://primcoat.app/glossary/golden-image.md
- https://primcoat.app/glossary/immutable-infrastructure.md

---

Source: https://primcoat.app/glossary/qcow2
Primcoat — a managed VM image factory. https://primcoat.app
