A parent snapshot is the warm VM state that every forked child inherits. It is stored as two files on disk —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/deeplethe/forkd/llms.txt
Use this file to discover all available pages before exploring further.
memory.bin (the full guest RAM image) and vmstate (vCPU registers, device state, and KVM context) — plus an optional rootfs.ext4 and a snapshot.json manifest. The parent boots once, imports your runtime (Python + dependencies, a warmed JVM, a loaded ML model), is paused, and written to disk. Children then mmap memory.bin with MAP_PRIVATE so the kernel implements copy-on-write at the page level: each child shares the parent’s resident memory until it diverges. This guide covers the three paths to create a snapshot and how to manage them locally.
Three paths to a snapshot
forkd from-image
Docker image → ext4 rootfs → boot + warmup → snapshot. Easiest path — one command.
forkd snapshot
Manual path: you supply kernel, rootfs, and tap. Full control over every parameter.
forkd snapshot --from-sandbox
Branch a running sandbox mid-execution. Covered in Branching.
Path A — forkd from-image (recommended)
forkd from-image wraps the full pipeline — Docker pull → ext4 build → boot + warmup → pause → register tag — into a single verb. The rootfs is cached after the first build, so re-running with the same image skips the Docker step.
mkfs.ext4 + warmup) and is nearly instant on subsequent runs because the rootfs is cached at /var/cache/forkd/<image-slug>.ext4.
Flags
| Flag | Default | Description |
|---|---|---|
<image> | (required) | Docker image reference, e.g. python:3.12-slim, ghcr.io/user/repo:tag |
--tag | (required) | Local snapshot tag: [A-Za-z0-9_][A-Za-z0-9._-]{0,63} |
--extra | (none) | Additional apt packages to bake into the rootfs. Repeatable. |
--size-mib | 1536 | Rootfs ext4 image size in MiB |
--cache | /var/cache/forkd | Directory where built rootfs artifacts are cached |
--kernel | auto-detected | Path to vmlinux kernel image. Searched at ./vmlinux-6.1.141, ./vmlinux, /var/lib/forkd/kernels/vmlinux |
--tap | forkd-tap0 | Host tap device for the boot warmup |
--boot-wait-secs | 10 | Seconds to wait for the guest to settle before snapshotting |
--mem-size-mib | 512 | Parent VM memory in MiB. Increase for browser or ML model warmups |
Full example
forkd images will show the new tag.
Path B — forkd snapshot (manual)
Use this path when you have a kernel and rootfs on disk and want direct control over every boot parameter.
--boot-wait-secs seconds, is paused, and the memory image + vmstate are written to ~/.local/share/forkd/snapshots/<tag>/.
Flags
| Flag | Description |
|---|---|
--tag | Snapshot name. Required. |
--kernel | Path to vmlinux kernel. Required (unless --from-sandbox). Also reads FORKD_KERNEL. |
--rootfs | Path to rootfs image (.ext4 for read-write, .squashfs for read-only). Required. Also reads FORKD_ROOTFS. |
--tap | Host tap device name (e.g. forkd-tap0). Also reads FORKD_TAP. |
--rw | Mount rootfs read-write (auto-enabled for *.ext4 files). |
--boot-wait-secs | Seconds to settle before snapshot. Default 10. |
--mem-size-mib | Override parent VM RAM size in MiB. Default 512. |
--keep-workdir | Keep /tmp/forkd-parent-<tag>/ after snapshot for post-mortem inspection. |
--volume HOST:GUEST[:ro] | Attach a persistent volume (see below). |
Volumes
Volumes let you attach persistent ext4 images to a snapshot so every child inherits shared, writable (or read-only) storage. Common uses: pip/npm caches shared across all children, model weights loaded once at parent-boot time, agent scratch space.HOST:GUEST[:ro] format:
HOST— absolute path to an existing ext4 image on the hostGUEST— absolute mount path inside the VM:ro— optional read-only flag (default is read-write)
vdb through vdy). Volume specs are recorded in snapshot.json and automatically inherited by branched snapshots.
Path C — Branch a running sandbox
You can snapshot a running child sandbox mid-execution to create a new parent tag. This is the BRANCH operation — see Branching for the full guide.Listing and removing snapshots
List local snapshots
Remove a snapshot
forkd rmi calls DELETE /v1/snapshots/:tag on the daemon first (clean: removes registry entry + on-disk files atomically) and falls back to direct disk removal if the daemon is not running. In v0.5, removing a snapshot that is the parent_tag of a chained snapshot returns 409 Conflict; use --cascade or --force to override (see Snapshot Chains).
Snapshot directory layout
Every snapshot lives under~/.local/share/forkd/snapshots/<tag>/ (or $XDG_DATA_HOME/forkd/snapshots/<tag>/):
snapshot.json manifest records volume mounts and, for v0.5 chained snapshots, the parent_tag and parent_content_hash that pin the chain edge. Children mmap(memory.bin, MAP_PRIVATE) — the kernel handles copy-on-write at the page level with zero explicit copying at fork time.