From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:QCOW2" |
|---|
| claim | "The qcow2 header (all big endian) holds magic, version, backing file offset and size, cluster_bits, virtual size, crypt_method, L1 size and offset, refcount table offset and clusters, snapshot count and offset; version 3 adds incompatible/compatible/autoclear feature u64s, refcount_order, header_length and compression_type." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:QCOW2" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "QCowHeader" |
|---|
| size_min | "0x48" |
|---|
| endianness | "big" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "magic" |
|---|
|
| offset | "0x4" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "version" |
|---|
|
| offset | "0x8" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "backing_file_offset" |
|---|
|
| offset | "0x10" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "backing_file_size" |
|---|
|
| offset | "0x14" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "cluster_bits" |
|---|
|
| offset | "0x18" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "size" |
|---|
|
| offset | "0x20" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "crypt_method" |
|---|
|
| offset | "0x24" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "l1_size" |
|---|
|
| offset | "0x28" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "l1_table_offset" |
|---|
|
| offset | "0x30" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "refcount_table_offset" |
|---|
|
| offset | "0x38" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "refcount_table_clusters" |
|---|
|
| offset | "0x3c" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "nb_snapshots" |
|---|
|
| offset | "0x40" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "snapshots_offset" |
|---|
|
| offset | "0x48" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "incompatible_features" |
|---|
| condition | "version >= 3" |
|---|
|
| offset | "0x50" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "compatible_features" |
|---|
| condition | "version >= 3" |
|---|
|
| offset | "0x58" |
|---|
| size | 8 |
|---|
| type | "uint64_t" |
|---|
| name | "autoclear_features" |
|---|
| condition | "version >= 3" |
|---|
|
| offset | "0x60" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "refcount_order" |
|---|
| condition | "version >= 3" |
|---|
|
| offset | "0x64" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "header_length" |
|---|
| condition | "version >= 3" |
|---|
|
| offset | "0x68" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "compression_type" |
|---|
| condition | "version >= 3, header_length > 104" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "QCowHeader packed struct; offsets computed from field order" |
|---|
| repo | "qemu/qemu" |
|---|
| commit | "a19f59a72d96056d9a8f48cf6c77f5787491e414" |
|---|
| path | "block/qcow2.h" |
|---|
| lines | "155-183" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "QCowHeader" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T06:03:50.068Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:02:23.240Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read the packed QCowHeader in qemu block/qcow2.h and qcow2_do_open in block/qcow2.c at the cited commit: offsets as stated; versions 2 and 3 only, header_length forced to 72 for version 2, compression_type used only if header_length > offsetof(compression_type) = 104." |
|---|
|
|
|---|