Snapshots

Stop a sandbox with its memory intact, resume it in seconds, fork it instantly, and save named templates to start new sandboxes from.

.md

Sandboxer keeps three kinds of saved state for you:

Kind Made when Used for
Stop snapshot (disk + memory) You stop a sandbox, or auto-stop does resume — the same sandbox comes back with its processes running
Continuous snapshots (disk) Every 10 minutes while a sandbox runs, and at every stop fork, browsing and downloading files, recovery
Named snapshots (templates) You save one with a name sbx new --from <name> — start many sandboxes from a known state

All of them are copy-on-write reflinks on the node's filesystem: making one is O(1) in time and space until blocks change.

Automatic snapshots (continuous and stop) are free, with new ones replacing old ones: each sandbox keeps its latest two. A stopped sandbox keeps them for 14 days. Named snapshots are kept until you remove them.

Stop#

sbx stop sb_k3v9x2mq

A stop:

  1. freezes the filesystem so the disk image is consistent,
  2. pauses the VM and writes its memory and device state to disk,
  3. shuts the VM down and stops the meter.

The sandbox goes archiving → archived. The call returns immediately with a stop operation (stop_…); read it with GET /sandboxes/{id}/stops/{stopId} or wait for the sandbox.archived webhook. A stopped sandbox costs nothing and keeps everything.

When a stop is refused#

If the disk can't be snapshotted (rare — a failing node disk, for example), we keep the sandbox running rather than throw away your work, retry automatically, and pause billing for that time. The stop shows status: "failing" with an error. Only if you accept losing everything since the last good snapshot should you force it:

sbx stop sb_k3v9x2mq --force

Resume#

sbx resume sb_k3v9x2mq
sbx resume sb_k3v9x2mq --ttl 28800         # 8 hours of auto-stop
sbx resume sb_k3v9x2mq --type large        # bigger machine (cold boot)
sbx resume sb_k3v9x2mq --no-env            # strip your secrets for good

A resume restores memory. Your shell history, tmux panes, npm run dev, a Postgres server, an SSH tunnel, the desktop session, and an agent that was halfway through a turn are all still running — the clock is corrected and the network re-attached, and the processes carry on. This is the main difference from platforms where resume is a reboot.

Memory is restored on a machine with the same CPU type as the one the sandbox stopped on. If a machine with that CPU type is online but busy, the resume waits up to 2 minutes for it; if none is free by then (or none is online), it boots from disk instead (files intact, running processes not kept) and says so: the sandbox shows memoryRestored: false and resumeReason: "cpu_mismatch", and the CLI and MCP tell you. To wait for memory instead, pass requireMemory: true (sbx resume --require-memory, or requireMemory on the MCP resume_sandbox): it waits up to 30 minutes (even when none is online yet), and if no such machine frees up the resume fails with memory_unavailable and the sandbox stays stopped. It can't be combined with a size change (400 invalid_require_memory), since a new size always boots from disk.

We also fall back to a cold boot from disk (enabled systemd services start; hand-started processes don't) in other cases. The resume still succeeds.

After every resume the sandbox says which you got. memoryRestored is true when memory was restored and running processes were kept, and false when it booted from disk with your files intact. It's null before the first resume. When it's false, resumeReason says why:

resumeReason Why it booted from disk
cpu_mismatch No machine with the sandbox's CPU type was free in time
resized You changed the size with --type; a new size always boots from disk
no_memory_snapshot The stop kept no memory (for example, a sandbox created with snapshots off)
restore_failed The memory image couldn't be restored on the host

sbx resume right after sbx stop waits for the stop to finish, then resumes.

Resume options mirror create: type, ttlSeconds, env (replaces the per-sandbox variables), environment, noEnv, failFast, plus requireMemory. A sandbox that paused itself for being idle also resumes on its own when it's used: see idle auto-pause.

How long a stopped sandbox keeps its data#

A stopped sandbox keeps its disk, memory and automatic snapshots for 14 days after it last stopped, at no charge. On day 11 we email you that its data is about to be deleted. On day 14 the data is deleted: the sandbox stays in your list as expired, with dataExpiredAt set, and resuming, forking or saving it as a named snapshot answers 409 snapshot_data_expired.

  • Resuming it before day 14 keeps everything, and the 14 days start again from its next stop.
  • To keep a sandbox's state for longer, save a named snapshot. Named snapshots are kept until you delete them.
  • List the expired ones with GET /sandboxes?dataExpired=true, or those stopped before a time with stoppedBefore=<time>.
  • A stopped sandbox's dataExpiresAt says when its data is due to be deleted: at least 3 days after the day-11 email, so never before you've been warned. It's null when no deletion is scheduled: while the sandbox runs, once its data has expired, and for sandboxes the 14-day rule doesn't cover.
  • Sandboxes created before October 29, 2026 are kept until you delete them.
  • Accounts with zero data retention keep nothing after a stop.

Fork#

sbx fork sb_k3v9x2mq
sbx fork sb_k3v9x2mq --type large -e TENANT=acme --ttl 600

A fork is a new, independent sandbox made from a copy of the source's disk as it is at that moment. If the source is running, its filesystem is frozen for the instant of the copy, so files written just before the fork are in it. The source keeps running. A fork copies the disk only, never memory or running processes, so its memoryRestored is null.

  • The disk is a reflink copy, so forking a 100 GB sandbox is as quick as forking a 1 GB one.
  • The fork boots fresh from that disk with a new identity: new id, new subdomain, new machine-id and SSH host keys.
  • It inherits the source's type, environment version and per-sandbox env unless you pass your own. A fork of a noEnv sandbox is always noEnv.
  • It does not inherit the source's TTL — the default one hour applies unless you pass one, so forking a never-stopping sandbox doesn't create another one by accident.

Use forks for parallel attempts ("try three fixes at once"), per-user copies of a prepared environment, or a safe experiment on a copy of production data.

Named snapshots (templates)#

Install your stack once, save it, and start every new sandbox from it.

sbx snapshot sb_k3v9x2mq web-stack     # save (re-using a name replaces it)
sbx new --from web-stack               # deploy it, as many times as you like
sbx snapshot rm web-stack              # delete it
curl
curl -sS -X POST https://sandboxer.com/api/v1/named-snapshots \
  -H "Authorization: Bearer $SANDBOXER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId":"sb_k3v9x2mq","name":"web-stack"}'

curl -sS -X POST https://sandboxer.com/api/v1/sandboxes \
  -H "Authorization: Bearer $SANDBOXER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"web-stack"}'
  • Names are 1–63 lowercase letters, digits or dashes. latest, tree, pull, rm, save, current, self and new are reserved.
  • Saving from a running sandbox takes a fresh snapshot first; the status is saving until it's ready.
  • A named snapshot is independent of its source — delete the source and it still deploys. Named snapshots are kept until you delete them.
  • New sandboxes default to the snapshot's size; pass type to override.
  • A sandbox made from one of your named snapshots keeps that snapshot's per-sandbox environment variables unless you pass -e (env in the API). Passing any -e replaces the whole set. A sandbox made from a noEnv snapshot is always noEnv.
  • Named snapshots have no separate charge; what they store counts toward your plan's included storage (see Billing).

Share a template with another account#

sbx snapshot share web-stack          # prints a bsh_… code once
sbx snapshot shares web-stack         # list codes and how often they were used
sbx snapshot unshare web-stack shr_…  # revoke one

The other account runs sbx new --from bsh_…. Their sandbox is theirs and bills them. Your logins, API keys, secret files, repository credentials and SSH keys are removed from it; all other files come across. A shared snapshot never carries its per-sandbox environment variables: their sandbox gets only the ones they pass.

What a snapshot contains#

Saved Not saved
Everything on the disk: /home/user, /etc, installed packages, Docker images and volumes Pre-installed system tools (they come from the base image)
Memory and running processes (stop snapshots only) The contents of /tmp after a cold boot
Enabled systemd services Hosted-port tokens on a fork (re-run sbx host)

Browse, download and delete#

sbx snapshots sb_k3v9x2mq                     # list a sandbox's snapshots
sbx snapshot latest sb_k3v9x2mq               # the newest one
sbx snapshot tree <snapshotId>                # files and sizes, while stopped
sbx snapshot pull <snapshotId> -o ./restore   # download home_user/ and docker/
sbx snapshot delete <snapshotId>              # permanently delete one
sbx snapshot delete --all sb_k3v9x2mq         # delete all ordinary snapshots, keep the sandbox

Deletion is permanent and asynchronous: the snapshot disappears from lists at once and its data is purged in the background (GET /deletion-operations/{id} reports progress). Snapshots that a fork, a resume or a named snapshot still depends on are kept until nothing uses them.

Snapshots off#

Create with --no-snapshots ("snapshots": false) for throwaway work: nothing is captured in the background, and stopping the sandbox erases it. Such a sandbox can't be resumed, forked or saved as a template.