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

# Backups and updates

> Back up DNZ's database safely and update DNZ.

## Backups

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.

You can also keep zones as files: `dnz zone export example.com -o example.com.zone` writes a BIND
zone file. See [Import and export](/dns/import-export).

With Postgres or MySQL, use their own tools (`pg_dump`, `mysqldump`). See
[Database](/deploy/database#backups).

### Restoring

Stop DNZ, put the backup in place of the database file (and remove any `dnz.db-wal` and
`dnz.db-shm` next to it), then start DNZ again.

## Updates

**Binary**

[Copy the new binary](/deploy/install#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](/proxy/dnz-proxy) nodes, update them together with DNZ; the image ships both
binaries.


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