Prerequisites
-
A Blaxel workspace and an API key. Export both so the Blaxel SDK can find them:
-
An Archil disk in the Archil region of your choice, and the Blaxel region nearest to it, such as
us-pdx-1foraws-us-west-2.
disk CLI. The output includes the disk ID and a one-time mount token, which grants access to this disk only:
Mount the disk in a sandbox
This script creates a sandbox with the name you pass it, installs thearchil client, mounts the disk at /mnt/archil, and writes a file to it. The token is passed only to the mount command:
mount.ts
Share the disk between sandboxes
Run the script again with a new name:How the disk behaves in a sandbox
The mount uses conditional mode. With--conditional, every sandbox can read and write anywhere on the disk at the same time, and none of them holds a lock that another sandbox has to wait for. See Sharing disks.
Standby needs no special handling. When a sandbox goes to standby, the mount is suspended with it, and the client reconnects when the sandbox resumes.
Unmount before you delete a sandbox. The archil client buffers recent writes, and archil unmount returns once every one of them has reached the disk. Deleting a sandbox without unmounting can lose writes from its last few seconds.
Clean up
This script unmounts the disk in each sandbox you name, then deletes the sandbox:cleanup.ts
Next steps
- TypeScript SDK: read, write, and search the disk without mounting it.
- Sharing disks: how conditional mode and checkouts work.
archilCLI reference: everyarchil mountoption.