Command line

warm-img

Create, inspect and convert disk images with qemu-img's commands and options.

warm-img is Warm64's qemu-img, with the same commands and options, for raw images.

warm-img create -f raw disk.img 8G
warm-img info disk.img
warm-img resize disk.img +2G

Syntax

warm-img COMMAND [options] ...
  • Options can be written --name=value or --name value, plus short options (-f raw) where the command lists them.
  • An argument like -32M that starts with a digit is a value, not an option, so resize disk.img -32M works.
  • warm-img --help prints the usage; warm-img --version prints warm-img version 9.0.0 (warm64 1.0.0).
  • Errors print warm-img: MESSAGE and exit with status 1.

Formats

warm-img creates, inspects and converts raw images. -f and -O accept raw, and any other format is refused with Unknown file format 'X' (this machine opens raw images).

The machine opens more formats than its image tool creates. qcow2, VMDK, VDI, VHDX, QED and VPC images, made with QEMU's qemu-img, attach directly:

qemu-img create -f qcow2 disk.qcow2 8G
warm-system-aarch64 ... -drive file=disk.qcow2,format=qcow2,if=virtio

Commands

create

warm-img create [-f raw] [-o size=SIZE] FILE [SIZE]

Creates a sparse raw image, or truncates an existing file to SIZE. SIZE accepts k, M, G and T, and a bare number means bytes. -b (a backing file) is refused with a backing file needs a format with backing files (raw has none); -F is accepted alongside it.

warm-img create -f raw disk.img 8G
# Formatting 'disk.img', fmt=raw size=8589934592

info

warm-img info [--output=human|json] FILE

Prints the image's format, virtual size and space used on disk.

warm-img info --output=json disk.img
{
    "virtual-size": 8589934592,
    "filename": "disk.img",
    "format": "raw",
    "actual-size": 0,
    "dirty-flag": false
}

resize

warm-img resize [--shrink] FILE [+|-]SIZE

Grows the image to SIZE, or by +SIZE. Shrinking needs --shrink; without it, the command says Use the --shrink option to perform a shrink operation.

convert

warm-img convert [-f raw] [-O raw] [-S SIZE] [-p] SOURCE DESTINATION

Copies an image, leaving runs of zeros of at least -S bytes (default 4096) as holes, so the copy stays sparse. -S 0 writes every byte. The destination is always created or truncated.

Note Unlike qemu-img, convert takes one source only.

compare

warm-img compare [-f raw] [-F raw] [-s] [-q] A B

Prints Images are identical. and exits 0, or Content mismatch at offset N! and exits 1. Images of different sizes count as identical when the longer one's extra bytes are all zero, unless you give -s (strict), which prints Strict mode: Image size mismatch!. -f sets the first image's format and -F the second's. -q prints nothing, leaving only the exit status. An error also exits with 1 (qemu-img uses 2).

map

warm-img map [-f raw] [--start-offset=N] [--max-length=N] [--output=human|json] FILE

Lists the ranges that hold data, in 64 KiB units. A range counts as data when any of its bytes is non-zero.

measure

warm-img measure [-f raw] [-O raw] [--output=human|json] (--size SIZE | FILE)

Prints the space a raw image needs: required size and fully allocated size.

dd

warm-img dd [-f raw] [-O raw] [bs=512] [count=N] [skip=N] if=INPUT of=OUTPUT

Copies count blocks of bs bytes, skipping the first skip blocks of the input. The output is sparse.

bench

warm-img bench [-f raw] [-c COUNT] [-d DEPTH] [-s SIZE] [-o OFFSET] [-S STEP] [-w] [--pattern=N] FILE

Times COUNT (default 75000) reads of SIZE bytes (default 4096), or writes with -w. Requests run one after another: -d (default 64) appears in the summary line but doesn't make requests run in parallel.

Warning bench -w overwrites the image with the pattern byte.

check, commit, rebase, snapshot, amend, bitmap

Raw images have no metadata to check, no backing files and no internal snapshots, so these report what qemu-img reports for a raw image: check exits with status 63, the others with 1.

See also