Crate qcow2 [] [src]

This crate can parse and read qcow2 virtual disks, as used by qemu and other emulators.

Qcow2 is a flexible format for disk images, that only allocates space as needed. It has many other interesting features.

The following featuers are supported by this crate:

  • Reading blocks of virtual disk data.
  • Reading data that is not aligned to block boundaries.
  • Parsing and validation of the header.
  • Reporting the names of any unsupported features, using the "feature name table" extension.
  • Basic caching of guest data locations, so nearby reads will be fast.

These features are not yet supported, but should be easy to add:

  • Listing and reading snapshots.
  • Reading version 2, currently only version 3 is supported.
  • Reading compressed data.
  • Backing file support, so you can chain qcow2 files together.
  • Reporting information about images.

These features are harder, or less interesting to me. Patches welcome!

  • Reading encrypted qcow2 files.
  • Writing virtual disk data.
  • Repairing the disk if refcounts are out of date.
  • Compacting the virtual disk so it takes less space.
  • Maintaining a "dirty bitmap" to make backups faster.
  • Creating new qcow2 images.
  • Creating new snapshots.
  • Checking qcow2 images for inconsistencies.
  • Merging images into their backing file.
  • Resizing images.

The repository for this crate is at



A qcow2 image.


A reader of data from the virtual disk image.



The error type for Qcow2 operations.

Type Definitions


The result type for operations on qcow2 images.