Skip to content

Save States

vintagepc edited this page May 1, 2021 · 1 revision

Mini404 now supports taking advantage of QEMU's vmsd save states.

While this feature is currently in beta (please report any save-state related bugs you encounter) this means you can take snapshots of a state and restore them later. Note QEMU has restrictions in that to restore a state, the running machine must have been started with identical arguments (and therefore hardware) as when it was taken.

You can use it as follows:

  1. If not already done, create a disk image to save snapshots: qemu-img create -f qcow2 snapshots.qcow2 512M (Currently snapshot sizes are ~4Mb - so set the total image size accordingly).
  2. Add the QCOW2 disk to the machine by appending the following argument on the command line: -drive if=none,file=snapshots.qcow2
  3. While the machine is running, you can save a snapshot at any time in the (qemu) console with the command savevm <name>. For example, savevm mystate.
  4. You can either restore this state via the same console (loadvm <name>) or on a subsequent startup from the command line with a -loadvm argument, for example qemu-system-buddy [args...] -drive [snapshot drive args] -loadvm mystate.

You can see a list of snapshots on the drive with the qemu-img command, for example: qemu-img info snapshots.qcow2

image: snapshots.qcow2
file format: qcow2
virtual size: 512 MiB (536870912 bytes)
disk size: 4.08 MiB
cluster_size: 65536
Snapshot list:
ID        TAG               VM SIZE                DATE     VM CLOCK     ICOUNT
1         test              3.77 MiB 2021-05-01 14:02:22 00:01:12.146    
Clone this wiki locally