Guides

Snapshots

Save a running machine, GPU memory included, and pick up exactly where it left off, with savevm or by migrating to a file, as in QEMU.

A snapshot is the whole running machine: every core, every device, the RAM, the display's GPU memory and the shared folders' files. Restoring one picks up exactly where it stopped.

As in QEMU, there are two kinds:

savevmmigrate to a file
Saved inThe machine's qcow2 disks, by nameA file you name
Restore withloadvm TAG, or -loadvm TAG at launchA new machine with the same command line plus -incoming file:PATH
DisksSaved too: each disk's own snapshotNot saved: restore with the same disk files, unchanged
Machine after savingKeeps runningPaused (postmigrate)

Both are described on QEMU's disk images page.

savevm and loadvm

(warm) savevm before-upgrade
(warm) info snapshots
(warm) loadvm before-upgrade
(warm) delvm before-upgrade

From code, use the monitor or QMP's snapshot jobs:

await vm.hmp("savevm before-upgrade");
await vm.qmp("snapshot-load", { "job-id": "load1", tag: "before-upgrade", vmstate: "virtio0", devices: ["virtio0"] });

As in QEMU, savevm needs every writable disk to be a qcow2 image. Each disk takes a snapshot of its own contents, and the first one also holds the machine's state. qemu-img snapshot -l lists them. A machine with no qcow2 disk gets no block device can store vmstate for snapshot, and one with a writable raw disk gets Device 'virtio1' is writable but does not support snapshots.

A snapshot store of the host's

Instead, a host can keep savevm's states itself, by name: give it a snapshots store. Then savevm, loadvm, delvm and -loadvm use the store whether or not the machine has disks, and the disks aren't snapshotted. QMP's snapshot jobs, which name their disks, still save into the disks.

  • In Node: nodeWARMHost({ snapshotDir: "./snapshots" }) keeps them as NAME.warm64snap files, and a new machine can start from one with -loadvm TAG.
  • In a browser, a qcow2 disk fetched by URL lives in memory, so use a store backed by IndexedDB or OPFS to keep states after the page closes.

Saving to a file

await vm.qmp("migrate", { uri: "file:state.bin" });

Then start a machine with the same command line plus -incoming:

warm-system-aarch64 <same options> -incoming file:state.bin

Or start it with -incoming defer, and load the state with migrate-incoming when you're ready. The file is a QEMU migration stream, with Warm64's own state (the GPU's memory and the shared folders) alongside QEMU's sections.

What's included

  • Every core, the interrupt controller, the timers and every device's state.
  • RAM, skipping pages the guest never wrote to.
  • The shared folders' files.
  • With a display: the GPU's memory, every texture and buffer, and the screen.

See also