Creating your first Volume
Learn how to create persistent volumes and use them with sandboxes
Using the TypeScript SDK
Volumes provide persistent storage that survives sandbox restarts. Let’s create a volume, verify it exists, and use it with a sandbox.
Step 1: Create a Volume
Step 2: Verify the Volume Exists
List all volumes to confirm your volume was created:
Step 3: Create a Sandbox with the Volume
Attach your volume to a sandbox at a custom mount point:
Step 4: Download Something Heavy
Now let’s demonstrate persistence by downloading a large repository or dataset:
Step 5: Verify Data Persistence
Check that the data is actually on the volume:
Complete Example
Here’s a complete example that ties everything together:
Customizing Volume Size
You can specify different volume sizes when creating:
Using Multiple Volumes
You can mount multiple volumes to a single sandbox:
Response Structure
The create() method returns a Volume object:
Parameters
A descriptive name for your volume
Volume size in Kubernetes format (e.g., ‘10Gi’, ‘100Mi’, ‘1Ti’). Supported units: Mi, Gi, Ti
Volume Status
Volumes can have different statuses:
Pending- Volume is being createdBound- Volume is ready to useLost- Volume is unavailable (rare)
Wait for the volume status to be Bound before mounting it to a sandbox for best results.
Best Practices
- Choose appropriate sizes: Estimate your storage needs to avoid running out of space
- Use descriptive names: Name volumes based on their purpose (e.g.,
ml-models,datasets,cache) - Verify before use: Always check that a volume exists and is
Boundbefore mounting - Mount at logical paths: Use meaningful mount paths like
/data,/workspace,/models - Clean up: Delete volumes when no longer needed to free up resources
Next Steps
- Learn how to create volume snapshots to backup your volume data
- Check the API Reference for all volume operations