Skip to main content
Blaxel Volumes provide persistent storage that survives sandbox destruction and recreation.
For full documentation on creating, deleting, resizing, and listing volumes, see the Volumes overview.

Attach a volume to a sandbox

At this time, you can only attach one volume to a sandbox. A volume can also only be attached to one sandbox at a time.
To use a volume, attach it when you create a sandbox by passing an array of volume configurations to the volumes property. Each configuration must include the name of the volume to attach and the mountPath where it will be accessible inside the sandbox’s filesystem. The mount path will override the existing content of a directory.
import { SandboxInstance } from "@blaxel/core";

const sandbox = await SandboxInstance.create({
  name: "my-sandbox",
  image: "blaxel/nextjs:latest",
  memory: 4096,
  region: "us-pdx-1",
  volumes: [{
    name: "my-volume",     // Must match the name of the created volume
    mountPath: "/app",     // Directory inside the sandbox
    readOnly: false        // Set to true to prevent writes
  }],
  // ... other sandbox properties
});
Any files written to the /app directory within this sandbox will be stored on my-volume and will persist even if this sandbox is deleted. At this time, you cannot detach a volume from a sandbox.

Learn more about volumes

Learn how to create and manage volumes.

Learn more about volume templates

Pre-populate volumes with files for faster environment setup.
Last modified on March 26, 2026