Skip to main content
E2B sandboxes are short-lived: when one is killed or times out, its files go with it. Mount an Archil disk in the sandbox and anything written there stays on the disk, where the next sandbox can mount it and your app can read it with the Archil SDK, without starting a sandbox. E2B sandboxes support FUSE, so the disk mounts as a regular directory.

Prerequisites

Export your Archil API key and region, and your E2B API key, then install both SDKs:

Mount a disk

First, build an E2B template with the archil client installed and create a disk. You only do this once:
Run it with eval "$(npx tsx setup.ts)" (or eval "$(python setup.py)") to export the disk ID and the disk’s mount token, which grants access to this disk only. Now start a sandbox from the template, mount the disk at /mnt/archil, and write a file. archil needs root, so these commands run with user: "root", and the token is passed only to the mount command:
The archil client buffers recent writes, so the script unmounts before it kills the sandbox: archil unmount returns once every write has reached the disk. Run npx tsx mount.ts (or python mount.py) twice. Each run starts a new sandbox, and the second one finds the line the first one wrote:
A plain mount is exclusive: one sandbox holds the disk at a time. To mount it in several sandboxes at once, add --shared, and see Sharing disks.

Read it from anywhere

Both sandboxes are gone, and the file is still on the disk. Read it from your own machine or app with the SDK:
If a sandbox is killed before it unmounts, see Troubleshooting mounts on other platforms.

Clean up

Delete the disk with the disk CLI, and the E2B template:

Next steps