Persistent Storage
Persistent storage gives your container a place to keep state that survives restarts, redeploys, and rescheduling. Bahriya provisions this storage as replicated block SSD storage — every byte you write is kept in three independent copies behind the scenes so a single disk failure can't take your data offline.
How it works
- Each persistent volume has a name (a short handle, e.g.
data), a mount path inside the container (e.g. /var/lib/app), and a size in GB (1–50 GB per volume).
- A container can have multiple persistent volumes, each mounted at its own path.
- Persistent storage is billed at $0.30 per GB per month, billed per minute. The price reflects the three-copy replication that keeps your data safe.
- The default size when you enable persistent storage for the first time is 3 GB per volume.
- Maximum 50 GB per volume. Need more than that on a single mount? Open a support request.
Per-replica billing
This is the most important thing to understand about persistent storage on Bahriya.
Each replica of your container gets its own independent copy of every persistent volume. That means if you run a container with two replicas and attach a 10 GB volume, you have two 10 GB volumes provisioned — one per replica — and you pay for both.
| Container shape | Persistent storage billed |
| 1 replica × 1 volume × 10 GB | 10 GB |
| 3 replicas × 1 volume × 10 GB | 30 GB |
| 2 replicas × 2 volumes × 5 GB | 20 GB |
The console shows the full bill in the cost preview before you save.
Persistent storage and autoscaling
You cannot use autoscaling on a container that has persistent volumes attached.
The reason is data safety: autoscaling makes the platform create and destroy replicas based on demand. With persistent volumes, scaling up would silently create new (billed) volumes for the new replicas, and scaling down would permanently destroy the data on the replicas it removes. Neither is what you want.
If you need autoscaling, don't use persistent storage. If you need persistent storage, set a fixed replica count.
What happens when I delete a container?
When you terminate a container, all its persistent volumes are deleted along with it. There is no recovery period — please back up anything important to object storage or an external service before terminating.
Choosing a mount path
Each persistent volume mounts at the path you specify inside the container. Common conventions:
/data for general application state.
/var/lib/<app> for databases (e.g. /var/lib/postgresql).
/srv/<app> for service-managed data.
Pick paths your application writes to and configure your image to write there.
Billing summary
- $0.30 per GB per month per replica, billed per minute.
- Default size on first enable: 3 GB.
- Volumes are deleted with the container.