> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dnzwithazee.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backups and updates

> Back up DNZ, with its own scheduled backups or the database's tools, and update DNZ.

## Backups

DNZ backs itself up: **Settings → Backups** makes scheduled, optionally encrypted archives of the whole
install (zones, users, settings, DNSSEC keys, certificates, the GeoIP database) to a folder,
S3-compatible storage or SFTP, keeps N daily, weekly and monthly ones, and restores them onto any
database, even a new install from its first-run page. See [Backups and restore](https://docs.dnzwithazee.com/admin/backups.md).

The database's own tools work too. With SQLite, the default, all of DNZ's data is in one file:

| Install | Database |
| - | - |
| systemd | `/var/lib/dnz/dnz.db` |
| Docker | the `/data` volume (`dnz-data`) |
| Default | `dnz.db` in the working directory (`DNZ_DATABASE_URL`) |

Take a consistent copy while DNZ runs with SQLite's `.backup`:

```bash theme={null}
sqlite3 /var/lib/dnz/dnz.db ".backup '/root/dnz-$(date +%F).db'"
```

> [!WARNING]
>
> Don't just copy `dnz.db` while DNZ runs: recent changes may still be in `dnz.db-wal`. Use
> `.backup`, or stop DNZ first.

With Postgres or MySQL, use their own tools (`pg_dump`, `mysqldump`). See
[Database](https://docs.dnzwithazee.com/deploy/database.md#backups). To restore such a copy, stop DNZ, put it back in place of the
database (for SQLite, remove any `dnz.db-wal` and `dnz.db-shm` next to it), then start DNZ again.

## Updates

**Binary**

[Copy the new binary](https://docs.dnzwithazee.com/deploy/install.md#linux-binary) out of the new image, replace it and restart:

```bash theme={null}
sudo install -m 755 dnz/dnz /usr/local/bin/dnz
sudo systemctl restart dnz
```

**Docker**

```bash theme={null}
docker compose pull && docker compose up -d
```

Database migrations run automatically at startup. Take a backup before updating, so you can go
back.

If you run [dnz-proxy](https://docs.dnzwithazee.com/proxy/dnz-proxy.md) nodes, update them together with DNZ, to the same
version. With Docker, pull the same tag of `terrificci/dnz-proxy` on each node
(`docker compose pull && docker compose up -d`); with the binary, run the install script again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.