Using Volumes
Volumes allow you to store persistent data for services on Railway.

Creating a volume
You can create a new volume through the Command Palette (⌘K)
or by right-clicking the project canvas to bring up a menu:

via command palette

via right-click menu
When creating a volume, you will be prompted to select a service to connect the volume to:

You must configure the mount path of the volume in your service:

Using the volume
The volume mount point you specify will be available in your service as a directory to which you can read/write. If you mount a volume to /foobar, your application will be able to access it at the absolute path /foobar.
Manage volume files
Use the Railway CLI to inspect and manage files stored on a volume.
railway volume browse /The browse command opens an interactive TUI where you can browse, upload, download, edit, rename, and delete files.
For non-interactive workflows, use railway volume files:
railway volume files list /
railway volume files download /backup.tar ./backup.tar
railway volume files upload ./backup.tar /backup.tarSee railway volume for the full command reference.
Relative paths
Railway's build system puts your application files in an /app folder at the root of the container. If your application writes to a directory at a relative path, and you need to persist that data on the volume, your mount path should include the app path.
For example, if your application writes data to ./data, you should mount the volume to /app/data.
Provided variables
Attaching a Volume to a service will automatically make these environment variables available to the service at runtime:
RAILWAY_VOLUME_NAME: Name of the volume (e.g.foobar)RAILWAY_VOLUME_MOUNT_PATH: Mount path of the volume (e.g./foobar)
You do not need to define these variables on the service, they are automatically set by Railway at runtime.
Volume availability
Volumes are mounted to your service's container when it is started, not during build time.
If you write data to a directory at build time, it will not persist on the volume, even if it writes to the directory to which you have mounted the volume.
Note: Volumes are not mounted during pre-deploy time, if your pre-deploy command attempts to read or write data to a volume, it should be done as part of the start command.
Volumes are not mounted as overlays.
Permissions
Volumes are mounted as the root user. If you run an image that uses a non-root user, you should set the following variable on your service:
RAILWAY_RUN_UID=0Live Resizing the volume
To increase capacity in a volume, you can "live resize" it from the volume settings. Live resize is available on all paid plans (Hobby and Pro).
- Click on the volume to open the settings
- Click
Live Resize - Follow the prompts to live resize the volume

Railway performs volume resizing live without any downtime. The resize operation expands the underlying storage while your service continues running, and the filesystem is automatically extended to utilize the additional space. Your application maintains full read/write access throughout the entire process.
In certain scenarios, such as when a volume reaches 100% capacity, the system will automatically perform an offline resize instead to run data integrity checks. This will restart your service and result in brief downtime during the resize operation.
Volume auto-grow for high availability databases
Volume auto-grow increases the size of a high availability database cluster's volumes as they fill up, so the database doesn't run out of disk space.
Auto-grow applies to Railway's high availability database clusters: PostgreSQL, MySQL, Redis, and MongoDB. It doesn't apply to standalone (single-node) databases or to the volumes of other services. Resize those yourself with live resize.
How auto-grow works
Railway tracks the volume usage of every data node in a cluster, meaning the primary and each replica.
When the volume of any data node passes 90% usage, Railway grows the volumes of all data nodes in that cluster together, by 50%, to the same size. For example, a cluster with three 50 GB data volumes ends up with three 75 GB volumes. The grow starts within a few minutes of the volume passing 90%.
Auto-grow follows these rules:
- The grow is online. No node restarts or redeploys, and the database keeps serving connections.
- If the data nodes' volumes have different sizes, Railway first brings them all to the largest size.
- Volumes never shrink.
Other nodes in the cluster
Auto-grow resizes a cluster's data nodes. When they grow, the cluster's other nodes keep their size.
In a PostgreSQL cluster, the etcd nodes have volumes of their own. Those volumes are not resized when the data volumes grow. Railway grows the etcd volumes, together, only if an etcd volume itself passes 90% usage. That is unusual, because etcd stores very little data. HAProxy has no volume.
Plan limits
Auto-grow stops at the volume size limit of your plan.
- When a grow brings the volumes to 80% or more of the limit, the notification says that growth stops at the limit.
- When the volumes are already at the limit and one of them passes 90% usage, nothing grows. The workspace receives a critical "Database volume is full and cannot grow" notification. Free up space or upgrade your plan to give the database more room. On the Pro plan, storage beyond 1 TB requires an Enterprise plan. Contact support to discuss it.
When a volume can't grow online
If a volume can't be grown online, Railway resizes that node with a restart. Railway restarts one node at a time, and only while every other node is running, so the rest of the cluster keeps serving.
- Replicas are resized first, when a volume passes 90% usage.
- The primary is resized only once its own volume passes 95% usage, and only after leadership has moved to a replica that already has the new size.
If the node being resized was stopped, the resize starts it again.
Notifications
Railway notifies the workspace, in-app and by email, when auto-grow resizes a cluster's volumes and when it can't.
| Notification | Severity | What it means |
|---|---|---|
| Database volume grew | Info, or Warning when the new size is close to the plan limit | The volumes grew online and the database kept running. No action is needed. |
| Database volume grew with a restart | Warning | A volume couldn't grow online, so Railway restarted that node to resize it. |
| Database volume could not grow | Critical | Railway couldn't grow the volumes. Resize the volume from its settings with live resize. |
| Database volume needs a resize | Critical | The volumes can only grow with a restart, and Railway didn't restart a node. Resize the volume from its settings with live resize. |
| Database volume is full and cannot grow | Critical | The volumes are at your plan's limit. Free up space or upgrade your plan. On the Pro plan, contact support about an Enterprise plan. |
Pricing
For how volume storage is billed, see Pricing in the volumes reference and resource usage pricing.
Backups
Services with volumes support manual and automated backups, backups are covered in the backups reference guide.