Persistent Disks – Render Docs

You can attach a persistent disk to a paid Render web service, private service, or background worker. This enables you to preserve local filesystem changes across deploys and restarts.

By default, Render services have an ephemeral filesystem.

This means that without a persistent disk, any changes you make to a service's local files are lost every time the service redeploys or restarts.

Persistent disks are useful for services such as:

Persistent disks use the same high-performance SSDs as Render Postgres and Key Value instances. All disks are encrypted at rest, and so are their automatic daily snapshots.

Setup

Before you attach a persistent disk, it's helpful to understand important limitations and considerations.

You create a persistent disk from the Render Dashboard. You can do so during service creation (click Advanced at the bottom of the creation form), or any time after creation from your service's Disk page:

  1. Set your disk's mount path.
    • Only filesystem changes under this path are preserved across deploys and restarts! The rest of your service's filesystem remains ephemeral.
    • For more details, see Mount path.
  2. Choose a disk size.
    • You can increase your disk's size later, but you can't decrease it. Pick the smallest value that currently works for your service.
  3. Click Add disk.

After you save, Render triggers a new deploy for your service. The disk becomes available as soon as the deploy is live.

Mount path

When you attach a persistent disk to a service, you specify its absolute mount path. Only data written under this path is preserved across deploys and restarts.

You can mount a disk at any path except those listed below.

Specify a mount path according to how your service stores data:

To mount your disk in a subdirectory of your service's source code, the absolute path depends on your runtime:

Runtime Source code path Example disk mount path
Node.js, Python, Ruby, Elixir, and Rust /opt/render/project/src /opt/render/project/src/storage
Go /opt/render/project/go/src/github.com/<owner>/<repo> /opt/render/project/go/src/github.com/<owner>/<repo>/data
Docker Your Dockerfile's WORKDIR (commonly /app) /app/storage

Disallowed mount paths

You cannot mount a disk at any of these exact mount paths:

You can mount a disk at a subdirectory within one of these paths. For example, you can mount your disk at `/opt/render/project/src/uploads.

Monitoring usage

View your disk's usage over time from your service's Disk page in the Render Dashboard:

Disk snapshots

Render automatically creates a snapshot of your persistent disk once every 24 hours. If your disk experiences critical data loss or corruption, you can completely restore its state to any available snapshot. Snapshots are available for at least seven days after they're created.

Important:

Restore a snapshot from your service's Disk page in the Render Dashboard:

Restoring a custom database

If you use a persistent disk specifically to back a custom database instance on Render (such as MySQL or MongoDB), do not perform a disk restore for database recovery purposes. If you do, your database might restore to a corrupted state.

Instead, create regular backups of your database using a tool like mysqldump for MySQL or mongodump for MongoDB. Restore your database's state using one of these backups.

Transferring files

You can securely transfer files between your disk-backed service and your local machine using a tool like SCP or Magic-Wormhole.

SCP

After you set up SSH for your service, you can transfer files using SCP.

For example, if your ssh command looks like this:

$ ssh YOUR_SERVICE@ssh.YOUR_REGION.render.com

Then your scp commands look like this:

  # Copying a file from your service to your local machine
$ scp -s YOUR_SERVICE@ssh.YOUR_REGION.render.com:/path/to/remote/file /destination/path/for/local/file
  file        100% 5930KB 999.9KB/s   00:05

# Copying a file from your local machine to your service
$ scp -s /path/to/local/file YOUR_SERVICE@ssh.YOUR_REGION.render.com:/destination/path/for/remote/file
  file        100% 5930KB 999.9KB/s   00:05

We recommend using SCP with the -s flag to use the more modern SFTP protocol. Future releases of SCP will default to using SFTP, and this flag will no longer be needed.

Magic-Wormhole

The Magic-Wormhole library enables you to transfer files to and from your disk-backed service without using SSH and SCP.

  1. In the Render Dashboard, go to your service's Shell page.

  2. If you have a Docker-image-backed service, use the shell to install magic-wormhole:

    • Run apt update && apt install magic-wormhole or the equivalent for your environment.
    • The magic-wormhole library is pre-installed on all Render native runtimes.
  3. Use the shell to transfer your file with the wormhole command:

$ wormhole send /path/to/filename.txt
     Sending 10.5 MB file named 'filename.txt'
     Wormhole code is: 4-forever-regain
  1. Note the code that appears in the output from wormhole. Then, from any internet-connected machine, install magic-wormhole and run  wormhole receive, entering in the code when prompted.

Disk limitations and considerations

When attaching a persistent disk to your service, note the following: