Skillversitas

Backup and Restore

A QEMU microVM is backed up as its disk image. The safest approach is to stop the VM before copying, or to use qcow2 snapshots for online backups, and to verify restores regularly.

Offline Backup (Stopped VM)

systemctl stop microvm
qemu-img convert -O qcow2 microvm.qcow2 backup/microvm-$(date +%F).qcow2
qemu-img info backup/microvm-2026-11-06.qcow2
systemctl start microvm

Converting to qcow2 compresses the image, which makes it a good format for offsite storage.

Online Backup with qcow2 Snapshots

qemu-img snapshot -l microvm.qcow2
qemu-img snapshot -c backup-1 microvm.qcow2

For a consistent online backup of a small guest, flush the guest filesystem first (fsfreeze -f or a sync) before creating the snapshot. Restoring means stopping the VM and deleting all snapshots except the one you want, or converting from it.

Incremental and Rotated Backups

qemu-img convert -O qcow2 -S 64k -c microvm.qcow2 backup/microvm-$(date +%F).qcow2
rsync -a backup/ /mnt/nas/vm-backups/

Combine this with a rotation policy (daily for 7 days, weekly for 8 weeks) and test a full restore at least quarterly.

Restore Checklist

  1. Stop the running VM.
  2. Copy the backup image back to the original path.
  3. Start the VM and check services, clocks, and network.
  4. Verify application data: row counts, files, recent logs.

Summary

Back up a microVM by converting or snapshotting its qcow2 image while stopped (or after a filesystem flush), rsync the backups to another machine with rotation, and prove the process with scheduled restore tests that check services and data, not just boot messages.