Snapshots and forks
Copy a sandbox's disk into a new running sandbox to branch work, try risky changes or run things in parallel.
pols copies disks instead of rebuilding them. Every copy is a ZFS snapshot and clone on the host, so the copy takes well under a second no matter how much is on the disk. A fork from the disk still boots its VM and runs in about 2.5 seconds; a fork of a running sandbox skips the boot and gets a copy of its memory. You use copies in two ways:
- Fork a sandbox to get a second, independent sandbox that starts from its disk.
- Save a template to keep a disk as a starting point for many future sandboxes; see Templates.
Forking
pols fork web --name web-try
pols fork web --name web-locked --egress none
pols fork web --name web-ci --secret CI_TOKEN
pols fork (POST /v1/sandboxes/{sandbox}/fork) snapshots the source sandbox’s disk and clones it into a new VM. When the source is running, the fork also gets a copy of its memory and runs about 2 seconds after you ask; SSH answers 2.7 to 4.6 seconds after you ask. The source pauses while its memory is copied, about 1.5 seconds per 8 GiB. When the source is stopped, or the host has no room for the memory, the fork boots from the disk and runs about 2.5 seconds after you ask. The source may be running or stopped, and it stays as it was. The fork:
- is a new sandbox with its own ID, name and host label (without
--name, a generated name likebraveotter), the same size as the source, on the same host; - gets a new machine ID and new SSH host keys;
- keeps the source’s egress policy unless you set one;
- keeps the source’s environment variables and vault entries, and adds the ones you name with
--secret; - records its origin in
source_sandbox_id.
Forking checks the same quotas as creating a sandbox. For a larger size, resize the fork once it is made (the disk only grows).
What a fork contains
A fork of a running sandbox starts with the source’s disk and memory, so the processes that ran in the source run on in the fork, open browser tabs included, under the fork’s own name, address, machine ID and SSH host keys.
A fork that boots from the disk (of a stopped source, of a source on Incus, or when the host has no room for the memory) starts fresh: processes that ran in the source are not running in the fork, and data an application held only in memory is not there. Databases and other services that write to disk recover from it as they would after a power cut. For a clean copy of a running database, stop it (or the whole sandbox) before forking.
A sandbox on Incus, made before 11 October 2026 or placed there when Cloud Hypervisor has no room, always forks from its disk; its fork runs about 14 seconds after you ask.
Snapshots when stopping
Each time a sandbox stops, the host also takes a snapshot of its disk and keeps the last three. These snapshots belong to the sandbox and are deleted with it. They are not exposed through the API: you cannot list them or roll back to one. To keep a state you can return to, take a named checkpoint and roll back to it later, fork the sandbox or save a template:
pols checkpoint create web before-migration
pols rollback web before-migration
A checkpoint holds the disk only, not memory or processes, and a sandbox keeps at most 10. A rollback discards every change since the checkpoint and the checkpoints taken after it; a running sandbox is shut down, rolled back and booted again. See pols checkpoint and pols rollback.
Typical uses
- Try something risky. Fork, run the migration or upgrade in the fork, and delete whichever sandbox you no longer need.
- Fan out work. Prepare one sandbox, fork it once per task, and let an agent work in each fork in parallel.
- Reproduce a bug. Fork the sandbox where it happens and investigate the copy while the original keeps running.