This episode covers snapshot and restore: saving the entire VM state (devices and memory) with the snapshot API, restoring it, and getting to know the new offloaded snapshot daemon in v53. You'll also learn snapshot limitations (not cross-version) and best-practice formats for recovery and migration.

Now that VMs can be provisioned automatically with cloud-init in episode 9, it's time to talk about state resilience: what happens when you want to "freeze" a running VM and resume it later — or on another host? The answer is snapshot and restore.
Think of a snapshot as photographing the state of the entire VM: memory (RAM contents), CPU state, and device state are copied to disk. On restore, the VM resumes from exactly that point — running processes have no idea they were ever "frozen". This is the foundation for consistent backups, recovery, and (together with episode 11) live migration.
A Cloud Hypervisor snapshot stores three main things:
Because of this complexity, snapshots can't just be moved around: the device state format is tied to a specific version. Restoring snapshots across different Cloud Hypervisor versions is not supported — a topic we cover in the limitations section.
Snapshots are created through the API socket while the VM is running. Prepare a VM with --api-socket (episode 8), then call the snapshot endpoint:
curl --unix-socket /tmp/ch.sock -X PUT \
-H "Content-Type: application/json" \
--data '{
"destination_url": "file:///srv/snapshots/vm-01"
}' \
http://localhost/api/v1/vm.snapshotdestination_url: file:///srv/snapshots/vm-01 defines the output location. Cloud Hypervisor writes several files into that directory:
/srv/snapshots/vm-01/
├── memory_file # isi RAM guest
├── vm.json # state device & vCPU
└── (file device opsional lainnya)The snapshot process happens without stopping the VM. However, note that a snapshot isn't zero-downtime in the fullest sense — during creation there's a brief "stop the world" phase (the VM is paused, memory is copied, the VM resumes). For workloads that truly must keep running without interruption, live migration (episode 11) is the answer.
Important
Snapshot requires guest memory to be shared (--memory shared=on) — guest memory must be mappable and readable from outside the VMM process. Without it, the snapshot endpoint fails with a memory-mapping related error. Make sure this option is set from the VM's start.
Restore is done by running a new cloud-hypervisor that uses the snapshot state:
cloud-hypervisor \
--restore /srv/snapshots/vm-01 \
--disk path=ubuntu.raw \
--net tap=ch0,ip=192.168.100.1,mac=a8:21:95:80:35:e6--restore /srv/snapshots/vm-01 reads vm.json and memory_file, then resumes guest execution from the point the snapshot was taken. Note: device config such as --disk and --net must be provided again — the device state in the snapshot is re-referenced with matching CLI parameters. The MAC and disk paths must be consistent with when the snapshot was taken, because the guest keeps connection state against those devices.
Verify that processes in the guest continue:
uptime -s
ps aux | grep aplikasiuptime -s shows the original boot time (when the VM first started), not the restore time — proof that the VM resumed rather than rebooted.
Since v53.0 (12 July 2026), snapshot creation can be offloaded to a separate daemon process. Instead of the VMM handling memory copying inside its own process, an external daemon takes over that job. The advantages: the VMM is lighter during snapshots, snapshot creation can run in parallel on different hosts, and errors in the snapshot process don't bring down the VM.
cloud-hypervisor-offload --snapshot-daemon --socket /tmp/offload.sockThe flow: the VMM hands the memory reference to the daemon via a socket, the daemon copies memory to the snapshot file while the VMM keeps serving the VM. This reduces the "stop the world" pause and speeds up snapshot time — a significant improvement for environments doing mass snapshots.
The most important rule: a snapshot made with version X can only be restored with version X (or a compatible point-release within the same LTS). Don't expect a v50 snapshot to restore on v53. In production, store the VMM version used in the snapshot metadata and pin versions when deploying.
fstrim/sync) before snapshotting if you want full consistency.curl --unix-socket /tmp/ch.sock -X PUT \
--data '{"destination_url":"file:///srv/snapshots/vm-01"}' \
http://localhost/api/v1/vm.snapshot
tar czf backup-$(date +%F).tar.gz /srv/snapshots/vm-01Archive the snapshot together with the VM config (guest.json) and the binary version — that's a complete recovery package.
--memory shared=on forgotten: snapshot fails; set it from the start.Tip
For workloads that need application-level consistent snapshots (e.g., databases), combine the VMM snapshot with application mechanisms: pause the database, flush logs, snapshot, then resume. The VMM snapshot captures machine state; the application captures data state.
Key takeaways:
vm.snapshot API and restored with --restore.--memory shared=on from the start.In the next episode, episode 11, we'll cover live migration — moving VMs between hosts without downtime using the expanded protocol, including page-faults served from the source in v53. We'll set up shared storage and networking, then dissect version and device compatibility constraints. Your VMs can now start to "move house" without noticing.