Linux

Where Does BTCPay Server Store Data?

BTCPay Server keeps env, compose output and wallet data in Docker volumes. Backup set and restore notes.

Last updated

BTCPay Server centers on two host files plus a set of Docker volumes. The env file holds deployment secrets and fragment choices, while the generated compose file records the built stack. Everything valuable beyond that lives in named volumes: app data, Postgres, NBXplorer, chain data and Lightning stores.

Backups use the shipped script rather than raw folder copies. It dumps databases, stops the stack, archives volumes and skips re-downloadable chain data. Keep the env file with the resulting archive; one without the other restores an unconfigured shell.

Where BTCPay Server stores this, by platform

Linux
/root/btcpayserver-docker

Clone root with Generated/docker-compose.generated.yml and the btcpay-backup.sh script. Env at /root/.env (exported via /etc/profile.d). Volumes generated_btcpay_datadir, postgres, nbxplorer, bitcoin plus Lightning stores live under /var/lib/docker/volumes. Back up with the script, not file copies of live DBs.

Frequently asked questions

What do I back up for BTCPay Server?

Run btcpay-backup.sh from the docker root, then keep its archive plus the .env file. The script dumps databases and archives volumes while excluding chain data. Restoring needs both halves plus a fresh chain sync.

Where is the BTCPay env file?

Usually at /root/.env beside the btcpayserver-docker clone, exported through /etc/profile.d/btcpay-env.sh. It holds domain, fragments and secrets for compose generation. Guard it like credentials, since it unlocks the deployment.

Can I copy Docker volumes by hand?

Only stopped, and dumps beat copies for databases. Live Postgres copies corrupt silently, which is why the backup script dumps first. Chain data never needs backup: it re-syncs from the network on restore.

Notice an outdated path? Let us know.