Volumes are FUSE-based mounts that provide shared file access across Daytona Sandboxes. They enable sandboxes to read from large files instantly - no need to upload files manually to each sandbox. Volume data is stored in an S3-compatible object store.
- multiple volumes can be mounted to a single sandbox
- a single volume can be mounted to multiple sandboxes
Create Volumes
Daytona provides volumes as a shared storage solution for sandboxes. To create a volume:
- Navigate to Daytona Volumes ↗
- Click the Create Volume button
- Enter the volume name
The following snippets demonstrate how to create a volume using the Daytona SDK:
daytona = Daytona()
volume = daytona.volume.create("my-awesome-volume")
const daytona = new Daytona();
const volume = await daytona.volume.create("my-awesome-volume");
daytona = Daytona::Daytona.new
volume = daytona.volume.create("my-awesome-volume")
For more information, see the Python SDK, TypeScript SDK, and Ruby SDK references:
volume.get (Python SDK)
volume.get (TypeScript SDK)
volume.get (Ruby SDK)
Mount Volumes
Daytona provides an option to mount a volume to a sandbox. Once a volume is created, it can be mounted to a sandbox by specifying it in the CreateSandboxFromSnapshotParams object. Volume mount paths must meet the following requirements:
- Must be absolute paths: Mount paths must start with
/ (e.g., /home/daytona/volume)
- Cannot be root directory: Cannot mount to
/ or //
- No relative path components: Cannot contain
/../, /./, or end with /.. or /.
- No consecutive slashes: Cannot contain multiple consecutive slashes like
// (except at the beginning)
- Cannot mount to system directories: The following system directories are prohibited:
/proc, /sys, /dev, /boot, /etc, /bin, /sbin, /lib, /lib64
The following snippets demonstrate how to mount a volume to a sandbox:
import os
from daytona import CreateSandboxFromSnapshotParams, Daytona, VolumeMount
daytona = Daytona()
# Create a new volume or get an existing one
volume = daytona.volume.get("my-volume", create=True)
# Mount the volume to the sandbox
mount_dir_1 = "/home/daytona/volume"
params = CreateSandboxFromSnapshotParams(
language="python",
volumes=[VolumeMount(volume_id=volume.id, mount_path=mount_dir_1)],
)
sandbox = daytona.create(params)
# Mount a specific subpath within the volume
# This is useful for isolating data or implementing multi-tenancy
params = CreateSandboxFromSnapshotParams(
language="python",
volumes=[VolumeMount(volume_id=volume.id, mount_path=mount_dir_1, subpath="users/alice")],
)
sandbox2 = daytona.create(params)
import { Daytona } from '@daytonaio/sdk'
import path from 'path'
const daytona = new Daytona()
// Create a new volume or get an existing one
const volume = await daytona.volume.get('my-volume', true)
// Mount the volume to the sandbox
const mountDir1 = '/home/daytona/volume'
const sandbox1 = await daytona.create({
language: 'typescript',
volumes: [{ volumeId: volume.id, mountPath: mountDir1 }],
})
// Mount a specific subpath within the volume
// This is useful for isolating data or implementing multi-tenancy
const sandbox2 = await daytona.create({
language: 'typescript',
volumes: [
{ volumeId: volume.id, mountPath: mountDir, subpath: 'users/alice' },
],
})
require 'daytona'
daytona = Daytona::Daytona.new
# Create a new volume or get an existing one
volume = daytona.volume.get('my-volume', create: true)
# Mount the volume to the sandbox
mount_dir = '/home/daytona/volume'
params = Daytona::CreateSandboxFromSnapshotParams.new(
language: Daytona::CodeLanguage::PYTHON,
volumes: [DaytonaApiClient::SandboxVolume.new(volume_id: volume.id, mount_path: mount_dir)]
)
sandbox = daytona.create(params)
# Mount a specific subpath within the volume
# This is useful for isolating data or implementing multi-tenancy
params2 = Daytona::CreateSandboxFromSnapshotParams.new(
language: Daytona::CodeLanguage::PYTHON,
volumes: [DaytonaApiClient::SandboxVolume.new(
volume_id: volume.id,
mount_path: mount_dir,
subpath: 'users/alice'
)]
)
sandbox2 = daytona.create(params2)
For more information, see the Python SDK, TypeScript SDK and Ruby SDK references:
CreateSandboxFromSnapshotParams (Python SDK)
CreateSandboxFromSnapshotParams (TypeScript SDK)
CreateSandboxFromSnapshotParams (Ruby SDK)
Work with Volumes
Daytona provides an option to read from and write to the volume just like any other directory in the sandbox file system. Files written to the volume persist beyond the lifecycle of any individual sandbox.
The following snippet demonstrate how to read from and write to a volume:
# Write to a file in the mounted volume
with open("/home/daytona/volume/example.txt", "w") as f:
f.write("Hello from Daytona volume!")
# When you're done with the sandbox, you can remove it
# The volume will persist even after the sandbox is removed
sandbox.delete()
import fs from 'fs/promises'
// Write to a file in the mounted volume
await fs.writeFile('/home/daytona/volume/example.txt', 'Hello from Daytona volume!')
// When you're done with the sandbox, you can remove it
// The volume will persist even after the sandbox is removed
await daytona.delete(sandbox1)
# Write to a file in the mounted volume using the Sandbox file system API
sandbox.fs.upload_file('Hello from Daytona volume!', '/home/daytona/volume/example.txt')
# When you're done with the sandbox, you can remove it
# The volume will persist even after the sandbox is removed
daytona.delete(sandbox)
For more information, see the Python SDK, TypeScript SDK, and Ruby SDK references.
Get a Volume by name
Daytona provides an option to get a volume by its name.
daytona = Daytona()
volume = daytona.volume.get("my-awesome-volume", create=True)
print(f"{volume.name} ({volume.id})")
const daytona = new Daytona()
const volume = await daytona.volume.get('my-awesome-volume', true)
console.log(`Volume ${volume.name} is in state ${volume.state}`)
For more information, see the Python SDK, TypeScript SDK, and Ruby SDK references:
volume.get (Python SDK)
volume.get (TypeScript SDK)
volume.get (Ruby SDK)
List Volumes
Daytona provides an option to list all volumes.
daytona = Daytona()
volumes = daytona.volume.list()
for volume in volumes:
print(f"{volume.name} ({volume.id})")
const daytona = new Daytona()
const volumes = await daytona.volume.list()
console.log(`Found ${volumes.length} volumes`)
volumes.forEach(vol => console.log(`${vol.name} (${vol.id})`))
For more information, see the Python SDK, TypeScript SDK, and Ruby SDK references:
volume.list (Python SDK)
volume.list (TypeScript SDK)
volume.list (Ruby SDK)
Delete Volumes
Daytona provides an option to delete a volume. Deleted volumes cannot be recovered.
The following snippet demonstrate how to delete a volume:
volume = daytona.volume.get("my-volume", create=True)
daytona.volume.delete(volume)
const volume = await daytona.volume.get('my-volume', true)
await daytona.volume.delete(volume)
volume = daytona.volume.get('my-volume', create: true)
daytona.volume.delete(volume)
For more information, see the Python SDK, TypeScript SDK, and Ruby SDK references:
volume.delete (Python SDK)
volume.delete (TypeScript SDK)
volume.delete (Ruby SDK)
Limitations
Since volumes are FUSE-based mounts, they can not be used for applications that require block storage access (like database tables).
Volumes are generally slower for both read and write operations compared to the local sandbox file system.
Pricing & Limits
Daytona Volumes are included at no additional cost. Each organization can create up to 100 volumes, and volume data does not count against your storage quota.
You can view your current volume usage in the Daytona Dashboard ↗.