Where to start First steps track · 15 stages
Linux Labs

qemu-img — virtual machine disk images

cheat sheet · QEMU https://lab.dimsanych.ru/en/wiki/qemu-img/

Cheat sheet

  • qemu-img info --backing-chain disk.qcow2
  • qemu-img create -f qcow2 disk.qcow2 20G
  • qemu-img create -f qcow2 -F qcow2 -b golden.qcow2 overlay.qcow2 an overlay
  • qemu-img convert -O qcow2 src dst convert/compress (-c)
  • qemu-img resize disk.qcow2 +10G + grow the filesystem inside the guest
  • qemu-img snapshot -l/-c/-a/-d disk.qcow2 snapshots (on a shut-down VM)

Options

-f/-F set the format of the source and the backing image — almost always qcow2; a mismatch between the declared format and the file's real content corrupts the image silently, until the first read of the affected block. -O is the format of the destination image during conversion — easy to confuse with -f (the source format). -b links an overlay to its backing file at creation time; changing that link afterward is what rebase is for.

Loading…