Volumes
A Persistent Volume is a durable ext4 block device attached to a Computer or Sandbox so critical local state lives independently of the OS root image.
What survives sleep, restart, and image updates
| Lifecycle event | Durable SOMA disk (/opt/user) | Attached Persistent Volume (e.g. /data) | Running processes |
|---|---|---|---|
Sleep / Pause ($0 compute) | Preserved | Preserved | Kept during Firecracker pause (up to 30 min); restarted after stop |
Restart (POST /restart) | Preserved | Preserved | Restarted on fresh boot |
In-place image update (POST /computers/{id}/image) | Preserved (same Computer ID & viewer URL) | Preserved and re-attached automatically | Restarted on new template image |
Compute resize / soma/elastic-7 autoscale | Preserved (zero reboot) | Preserved (zero reboot) | Kept running |
Common workloads: authenticated browser & CRM sessions (/data/chrome-profile), always-on coding agent checkouts (/workspace), self-hosted automation state (/data/n8n, SQLite), and local model/package caches.
Volumes are NOT useful for:
- Stateful databases - use Postgres instead. It scales better, backs up automatically, and survives host failures.
- User-uploaded files - use Storage / Buckets. Cheaper, browser-uploadable, geo-replicable.
- Shared state across multiple replicas - volumes are typically attached to ONE runtime instance.
Create
Use it your way: API, CLI, or SDK
No SDK required.
Raw API (curl): the raw API takes size_bytes and a backend (use local).
# Create a 50 GB volume
curl -X POST https://api.miosa.ai/api/v1/volumes \
-H "Authorization: Bearer $MIOSA_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "model-weights", "size_bytes": 53687091200, "backend": "local"}'
# Attach it to a running computer at a mount path
curl -X POST https://api.miosa.ai/api/v1/computers/COMPUTER_ID/volumes \
-H "Authorization: Bearer $MIOSA_API_KEY" -H "Content-Type: application/json" \
-d '{"volume_id": "VOL_ID", "mount_path": "/mnt/data"}'
# Detach (by attachment id)
curl -X DELETE https://api.miosa.ai/api/v1/computers/COMPUTER_ID/volumes/ATTACHMENT_ID \
-H "Authorization: Bearer $MIOSA_API_KEY" When upgrading a SOMA computer’s template via POST /api/v1/computers/{id}/image, MIOSA keeps both /opt/user and every attached volume mounted, reporting preserved_volume_id and preserved_volume_attachment_ids in the response.
CLI:
miosa volume create model-weights --size-gb 50
miosa volume list Attach and detach are per-computer; drive them with miosa api:
# Attach the volume to a running computer at a mount path
miosa api POST /computers/<computer-id>/volumes \
-d '{"volume_id": "<volume-id>", "mount_path": "/mnt/data"}'
# Detach by attachment id
miosa api DELETE /computers/<computer-id>/volumes/<attachment-id> Delete a volume (it must be detached first):
miosa volume rm <volume-id> A local-backend volume lives on one host, so it attaches to computers on that same host. Cross-host attach returns a clear error rather than failing silently.
Mount
A volume is mounted into the runtime instance’s filesystem at a path:
await miosa.services.update(serviceId, {
volumes: [
{ dataServiceId: volumeId, mountPath: "/var/models" },
],
}) At boot, /var/models is the volume’s contents. Writes persist.
Replicas and volumes
Most volumes attach to a single runtime instance. If you scale a service to N replicas, by default each replica gets the same volume mount if it’s marked shared: true, or its own volume if shared: false.
Shared volumes have all the usual concurrency caveats (filesystem locks, file-corruption risk if multiple writers touch the same file). Use Postgres for shared state unless you really know what you’re doing.
Limits
| Limit | Default |
|---|---|
| Max volume size | 500 GB |
| Max volumes per project | 10 |
| Filesystem | ext4 |
| Host placement | Must match the computer host |
When to use a volume
Realistic short list:
- You’re shipping a self-hosted SQLite-backed app to keep deployment simple.
- You’re running an LLM inference service and don’t want to re-download model weights on every instance start.
- You have a writable filesystem cache that’s expensive to rebuild.
Anything else, use Postgres or Storage.