Skip to main content
Baseten Sandboxes are now available and free to use until November 16. Each organization can run up to 10 sandboxes at once. To raise this limit, contact support.
A sandbox volume is a persistent disk that keeps its files after the sandboxes that mount it are deleted or expire. Mount one when a later sandbox needs the same data, such as a dataset, a model cache, or a project checkout. A volume belongs to one region. Only sandboxes in that region can mount it, one sandbox at a time. A volume can grow but never shrink. Without a volume, a sandbox’s files are deleted with it; see Local data. Set up your SDK or the CLI before running these examples.

Create a volume

To create a volume: Creation returns before the volume is ready. The volume is ready when its status is DEPLOYED, and its region is the one to use when you mount it.
Run the following code, which waits until the volume is ready:

Mount a volume

To mount a volume in a new sandbox: Create a sandbox in the volume’s region with the volume mounted at /data.
Run the following code with the same client:
To mount it read-only, add readOnly: true to the mount.
To confirm the mount: Run the following command to check the file system mounted at /data:
The output shows the volume’s size and usage. Files that the sandbox writes under /data stay on the volume after you delete the sandbox.

Grow a volume

To grow a volume to 20 GiB:
Run the following code:

Delete a volume

To delete a volume and its files: First delete the sandboxes that mount the volume.
Run the following code:
The sandbox volume CLI commands are pre-release, so their flags and output may change. For more information, see baseten sandbox volume, Create a sandbox volume, and Sandbox lifecycle and expiration.