A snapshot is a portable, on-disk capture of a sandbox’s writable filesystem. Move it withDocumentation Index
Fetch the complete documentation index at: https://docs.microsandbox.dev/llms.txt
Use this file to discover all available pages before exploring further.
scp, archive it as .tar.zst, or boot fresh sandboxes from it.
Snapshots are disk-only and stopped-only: the sandbox can’t be running when you take one. Memory and CPU state, plus qcow2 backing chains, are future work.
What gets captured
| Captured | Not captured |
|---|---|
upper.ext4, the sandbox’s writable overlay | Memory contents |
| Pinned image reference + manifest digest | CPU registers / running processes |
fstype, format, optional labels | Network state |
| Optional content-integrity hash | Open file handles |
Quick start
You’ll usually reach for the CLI first:Snapshot a stopped sandbox
Snapshot under a bare name (resolved to~/.microsandbox/snapshots/<name>/) or to an explicit path:
Boot from a snapshot
A snapshot already pins its image, so booting from one is mutually exclusive with the image source:upper.ext4 into the new sandbox’s directory. Reflinks use clonefile on macOS APFS, FICLONE on btrfs/XFS, with a sparse-aware fallback on ext4, so each new sandbox gets an independent COW copy without paying the bytes again.
List, inspect, and remove
inspect and the boot flow; the load-bearing local operation has to stay fast.
list and get are backed by a small local index DB. The index is just a cache for fast lookups, not a source of truth; if it ever gets out of sync (or you delete it), reindex rebuilds it from the artifacts on disk.
Move snapshots between machines
The artifact is a directory containingmanifest.json (canonical JSON; identity is the SHA-256 of these bytes) plus the captured upper.ext4. The directory is the snapshot; there’s no hidden daemon state, so any of these three transports work:
.tar.zst since zstd collapses sparse zero runs cheaply. Pass --plain-tar for a plain .tar; both are accepted on import via magic-byte detection.
Or drive export and import from code:
Integrity verification
By default, snapshot creation does not hash the upper file. The artifact carries the upper’s size and the pinned image’s manifest digest, which together catch any corruption that would stop it from booting. Skipping the hash keepsinspect fast on multi-GB sparse upper layers, where the cost would otherwise dominate.
Opt in to a content-integrity hash when crossing a trust boundary:
msb snapshot export automatically populates the integrity hash before bundling, and msb snapshot import verifies it on the way in. The local index path stays fast; the cross-machine path stays trustworthy.
Use cases
- Reusable build state. Install dependencies once, snapshot, then
msb run --snapshot ...repeatedly without paying the install cost. Common pattern for CI, agent workloads, and reproducible dev environments. - Portable scratch state. Capture a sandbox after a long setup, hand the artifact to a teammate or push it to shared storage, and let them boot from the same starting point.
- Local fork-by-copy. Multiple sandboxes from one snapshot are independent; each copy of the upper layer diverges on its own.
- Disaster recovery. Snapshot a sandbox before a risky migration; if it goes wrong,
msb rmthe broken one andmsb run --snapshotfrom the pre-migration artifact.
What’s not yet supported
- Live (running) snapshots. The sandbox must be stopped first. Live capture requires an in-guest filesystem freeze and memory checkpointing that’s tracked as future work.
- qcow2 backing chains. Snapshots always copy the upper layer today. The manifest’s
formatandparentfields are reserved so qcow2 chains can land additively without a schema break. - Push/pull from a registry. The artifact format is registry-shaped on purpose, but transport tooling beyond
scpandtar.zstis a separate piece of work. - Snapshotting
DiskImagevolumes. The same mechanism would apply (reflink the disk file), but is currently out of scope.