The information about QCOW2 metadata allocations in an image ELF-file is helpful for finding issues with the image data integrity.
v2: Descriptions of the new key option were added and the names of identifiers were amended (suggested by Eric). Discussed in the email thread with ID <1577447039-400109-1-git-send-email-andrey.shinkev...@virtuozzo.com> Snapshots dump example: $ sudo ./qemu-img check /.../.../harddisk.hdd -M --output=json { "image-end-offset": 24820842496, "total-clusters": 153600, "check-errors": 0, "viscera": { "refcount-table": { "location": { "offset": 3845128192, "size": 1048576 } }, "active-l1": { "name": "L1 active table", "location": { "offset": 4194304, "size": 16 }, "l2-list": [ { "offset": 619708416, "size": 1048576 }, { "offset": 1156579328, "size": 1048576 } ] }, "qcow2-header": { "location": { "offset": 0, "size": 1048576 }, "version": 3 }, "snapshot-table": { "location": { "offset": 648019968, "size": 191 }, "l1-list": [ { "name": "{3036f6c5-3a1f-44cb-af1f-653cc87fba04}", "location": { "offset": 14680064, "size": 16 }, "l2-list": [ { "offset": 3957325824, "size": 1048576 }, { "offset": 7025459200, "size": 1048576 } ] }, { "name": "{0aa1a7d6-16ee-4b44-a515-b5ecc571c959}", "location": { "offset": 638582784, "size": 16 }, "l2-list": [ { "offset": 3957325824, "size": 1048576 }, { "offset": 7025459200, "size": 1048576 } ] } ] } }, "allocated-clusters": 22485, "filename": "/.../.../harddisk.hdd", "format": "qcow2", "fragmented-clusters": 3549 } Bitmaps dump example: $ ./qemu-img check /home/disk -M --output=json { "image-end-offset": 1441792, "total-clusters": 16, "check-errors": 0, "viscera": { "refcount-table": { "location": { "offset": 65536, "size": 65536 } }, "active-l1": { "name": "L1 active table", "location": { "offset": 196608, "size": 8 }, "l2-list": [ { "offset": 262144, "size": 65536 } ] }, "bitmaps": { "bitmap-dir": { "location": { "offset": 1048576, "size": 64 }, "dir-entries": [ { "bitmap-table": { "location": { "offset": 589824, "size": 8 }, "table-entries": [ { "type": "all-zeros" } ] }, "bitmap-name": "bitmap-1" }, { "bitmap-table": { "location": { "offset": 983040, "size": 8 }, "table-entries": [ { "cluster": { "offset": 655360, "size": 65536 }, "type": "serialized" } ] }, "bitmap-name": "bitmap-2" } ] }, "nb-bitmaps": 2 }, "qcow2-header": { "location": { "offset": 0, "size": 65536 }, "version": 3 } }, "allocated-clusters": 12, "filename": "/home/disk", "format": "qcow2", "fragmented-clusters": 2 } Andrey Shinkevich (2): qcow2: introduce Qcow2Metadata structure qcow2: dump QCOW2 metadata block/qcow2-bitmap.c | 54 ++++++++++++- block/qcow2-refcount.c | 84 ++++++++++++++++---- block/qcow2.c | 30 +++++++ block/qcow2.h | 6 +- include/block/block.h | 3 +- qapi/block-core.json | 209 ++++++++++++++++++++++++++++++++++++++++++++++++- qemu-img.c | 30 ++++++- qemu-img.texi | 6 +- 8 files changed, 397 insertions(+), 25 deletions(-) -- 1.8.3.1