# Daily database backups and restore on your VPS ox backs up your app's databases every day with nothing to turn on. Back up now, keep copies in your S3 bucket, download a backup, and restore it safely. ox backs up your app's databases every day, soon after 03:00 UTC, with nothing to turn on: PostgreSQL with `pg_dump`, and SQLite and a project's own Redis or MySQL as files. Each backup is kept on your server, and a copy goes to your own S3 bucket when you add one. You can also back up now, download a backup, and restore from one with `ox restore`. ## Turn on daily backups There is no switch: backups are on for every service that can be backed up, from its first deploy. - **PostgreSQL** is backed up with `pg_dump` while it keeps running, whether the database is shared or only for this project. - **Redis, Neo4j, Qdrant and MySQL** are backed up as files when they run only for this project. The service stops for a moment while its files are copied, and the log says for how long. A shared one is not backed up. - **A custom service** is backed up as files too. Set `backup = false` on it in ox.toml to skip it ([custom services](https://deploywithox.com/docs/config#custom-services)). - **SQLite files** in the project's data folder are backed up as well. The daily backup runs once a day, soon after 03:00 UTC. Each one is kept on your server. To keep a copy off the server too, add an S3 bucket in Settings, or from a terminal: Send backups to S3 as well: ```sh ox settings s3 --endpoint https://.r2.cloudflarestorage.com --bucket ox-backups --access-key --from-file secret.txt ``` `--from-file` reads the secret key from a file, or from standard input with `-`, so it never sits on the command line. Without S3, the backup log says `no S3 target in Settings; the backup stays on this host`. ## How many backups ox keeps | Kind | On your server | In S3 | | --- | --- | --- | | Daily | 7, or 2 once S3 has a copy | 30, daily and manual together | | Manual (Back up now) | 3 | 30, daily and manual together | | Before migrate | 3 | Not sent to S3 | The counts are per service. One project's backups may take up to 20% of the server's disk; past that, ox deletes the oldest ones first, but it always keeps the newest backup of each service. A **before migrate** backup is the copy ox makes of each PostgreSQL database that has tables, right before a deploy runs its migrate step. It is the one to restore when a [rollback](https://deploywithox.com/docs/operate/rollback#database) needs the old tables back. ## Run a database backup now In the dashboard, open the project's **Backups** tab and press **Back up now** on the service. From a terminal, name the service entry as it is in ox.toml: Back up now: ```sh ox backups shop now postgres --wait ``` Without `--wait`, it prints `Started backups on shop: run ` and the command to read its log. ## List and download backups The Backups tab lists each backup with its time, size and kind, and a **Download** button. From a terminal: List and download: ```sh ox backups shop ox backups shop download postgres backup:daily-20261007T030512Z.dump ``` The SOURCE column of the list is what the other commands take: - `backup:` is a backup on your server. - `s3:` is a copy in your S3 bucket. - `trash: