Skip to main content
A persistent volume is an ext4 drive attached to a workspace as a second disk, separate from the workspace’s root filesystem. It keeps application data separate from managed app releases and workspace image replacement.

Why you need one

In v0.13, incremental deployment prepares application code in managed release directories. Those directories are not durable writable storage. Put databases, uploads, and other mutable files on a data volume instead of beside source code. Durable state belongs on a persistent volume. The usual convention is a volume named data mounted at /home/developer/data, exposed to the app as DATA_DIR:
Store SQLite databases, uploaded files, and logs under $DATA_DIR and they stay put across deploys.
A persistent volume survives app redeploys, app restarts, and stop→start of the workspace. It is destroyed only when you delete the volume or the workspace itself.

Declare a volume in rig.yaml

The canonical path is to declare durable disks once under workspace.volumes, then opt each app into the mount with volumes: [data]. The volume is created or reattached on deploy, and only apps that reference it receive the mount.
Point DATA_DIR at the same path and your app reads and writes durable state there. For multi-app projects, keep the declaration at the workspace level and attach it only to the apps that need it:
App references can be written as volumes: [data] or volumes: [{ name: data }]. App-local full specs are still supported for single-app or one-off cases:

Manage volumes with the CLI

You can also manage volumes independently of a deploy. Run locally, stop the workspace before create/resize/remove, then start it to attach the updated drive set:
rig volume resize and rig volume rm take the volume id (from rig volume ls), not its name.
Each command targets a specific workspace with --workspace:
Deleting a volume (rig volume rm) permanently destroys the data on it. This is separate from deleting the workspace — but deleting the workspace destroys its volumes too.

The SQLite-under-$DATA_DIR pattern

The most common use is a SQLite database that outlives deploys. Two pieces make it work:
  1. Set DATA_DIR=/home/developer/data in env: and put the database file under it.
  2. mkdir -p "$DATA_DIR" at startup — a fresh workspace may not have the directory yet.
Because notes.db lives on the volume, not in the synced app directory, an app release updates code while the database file remains on its separate disk.
To verify persistence, deploy the app, create some data, run rig deploy again, and confirm the data is still there. Verify the mount and data path; an environment variable alone does not create durable storage.

Next steps

For complete resize/removal steps, see volume management.