mode option, which is 'full' (the default)
or 'filesystem'. The same option exists on pause(), on the timeout auto-pause, and on
createSnapshot() / create_snapshot(). The type is exported as SnapshotMode in both SDKs.
mode is available from JavaScript SDK e2b 2.55.0 and Python SDK e2b 2.55.0. Earlier
SDKs expose the filesystem-only pause through keepMemory: false (JavaScript) /
keep_memory=False (Python), which keep working but are deprecated in favor of
mode: 'filesystem' / mode="filesystem". Passing both to the same call is rejected client-side.Full vs. filesystem-only
Network connections to clients outside the sandbox drop when it pauses — in both cases — and must be re-established on resume (see Persistence). The in-sandbox
difference: a full snapshot keeps the process running so it can serve again immediately, while a filesystem-only snapshot reboots, so the service must be restarted first.
Create a filesystem-only snapshot
Passmode: 'filesystem' (JavaScript) / mode="filesystem" (Python) to createSnapshot() /
create_snapshot(). The source sandbox is paused while the filesystem is captured and then
keeps running either way; the resulting snapshot has no memory image, so every sandbox
created from it reboots from disk.
mode (or passing 'full') takes a full memory snapshot, as before. Everything else
about snapshots — naming, listing, deleting, creating sandboxes from them — works the same way;
see Snapshots.
When the request is refused
If filesystem-only snapshots are not enabled for your project yet, the request is refused before the sandbox is touched. The sandbox keeps running and no snapshot is created.
In JavaScript this is a
SandboxError with statusCode 400; in Python a SandboxException
with status_code 400. A full memory snapshot is never affected.
Pause filesystem-only
Passmode: 'filesystem' (JavaScript) / mode="filesystem" (Python) to pause(). The filesystem is saved; memory is dropped.
mode defaults to 'full', so omitting it (or calling pause()) takes a full memory snapshot — see Persistence.
mode is a per-pause choice, not a sandbox-wide setting. Pausing once with mode: 'filesystem' (JavaScript) / mode="filesystem" (Python) does not lock the sandbox into filesystem-only: after you resume, the next pause() takes a full memory snapshot again unless you pass it once more.
The older keepMemory: false / keep_memory=False form still works and means the same as mode: 'filesystem' / mode="filesystem"; it is deprecated, and a call that passes both options is rejected with InvalidArgumentError / InvalidArgumentException.
Auto-pause filesystem-only
You can also make the timeout-driven auto-pause filesystem-only. SetonTimeout / on_timeout to the object form and include mode:
lifecycle reference.
Type safety and validation
mode only governs a pause action, so the SDK rejects nonsensical combinations:
- It cannot be set when the action is
kill. In TypeScript this is a compile-time type error (theonTimeoutobject is a discriminated union onaction); in Python it raisesInvalidArgumentException. - It cannot be combined with auto-resume. A filesystem-only snapshot can’t be woken by inbound traffic (auto-resume restores the running process from memory, which a filesystem-only snapshot doesn’t have), so it must be resumed explicitly with
connect(). Settingmode: 'filesystem'/mode="filesystem"together withautoResume: true/auto_resume=Trueis rejected client-side. modeand the deprecatedkeepMemory/keep_memorycannot be passed together.
What changes on resume
Resuming a filesystem-only snapshot, or creating a sandbox from one, is a reboot from disk rather than the near-instant in-place memory restore. Any service running inside the sandbox must be started again, and clients must reconnect.Expect the boot to take several seconds. A filesystem-only snapshot is a new build that no
node has cached yet, so the first sandboxes started from it read the root filesystem from
storage block by block while booting. The boot also runs the template’s own startup units, so a
template whose boot is slow stays slow here.
Picking up envd updates
envd is E2B’s in-sandbox daemon. The envd version a sandbox runs is pinned by its
template, so by default a long-lived paused sandbox stays on that version for its whole
lifetime and does not pick up later envd fixes and improvements.
A filesystem-only resume reboots the sandbox from disk, and that reboot can bring the
sandbox up on a newer envd than its template shipped. The filesystem is untouched. This
is how a long-lived sandbox can adopt envd improvements - for example around memory
management, stability, and speed - without losing the data on disk.
To move an existing sandbox onto a newer envd:
- Resume the sandbox.
- Pause it filesystem-only with
mode: 'filesystem'(JavaScript) /mode="filesystem"(Python). - Resume it again. This reboot can bring it up on a newer
envd.
A sandbox has to be resumable to use this flow. A sandbox whose snapshot already fails to
resume cannot be paused filesystem-only in the first place, so it cannot be upgraded this way.
Related
- Snapshots — create snapshots and start new sandboxes from them.
- Sandbox persistence — full (memory + filesystem) pause and resume.
- Auto-resume on request — the full
lifecycleconfiguration reference. - Reboot on resume — skip the memory of a snapshot that has it.
- Connect to a sandbox — resume a paused sandbox explicitly.