# Disaster recovery

> Rebuild a whole server from the external backup with berth dr plan and berth dr restore, also onto another operating system, from the browser on a fresh install, or as a drill on a disposable server.

Source: https://www.berthpanel.app/library/disaster-recovery/ · Category: backup · Updated: 2026-10-30

When a server is gone (hardware failure, ransomware, a mistake that cannot be undone), Berth rebuilds it on a new machine from the external backup alone: configuration, panel database, every subscription with its websites, mail and databases, the same system users and uids. This article describes what you need, the steps, how restoring onto a different operating system works, the browser route on a fresh install, and how to practise safely with a drill.

As a reference point: in a real drill, a server with a little over 100 GB of websites, mail and databases was restored from S3 in 79 minutes without errors, and every database and mailbox was identical to the source.

## Before you need it

Disaster recovery only works if you set it up beforehand:

- An **external deduplicated place** ([S3](https://www.berthpanel.app/library/backup-to-s3/), a [NAS](https://www.berthpanel.app/library/backup-to-nas/), SFTP, …) with a schedule that includes **the server settings** (the option *Also the server settings*). The one-key wizard and the NAS assistant create such a schedule for you.
- Subscriptions whose content reaches that place: directly, through a copy of the archives, or through a copy of the history. Berth warns when it does not; see [How backups work](https://www.berthpanel.app/library/backups-overview/#does-all-customer-data-actually-leave-the-server).
- The **repository password**, stored outside the server, for example in a password vault. Without it the backup cannot be read.
- For a NAS: `NOODHERSTEL.md` and `certificaat.pem` from the package.

Test it with a drill (below) before you have to rely on it.

## What you need on the day

- The repository address (`s3:…`, `sftp:…`, `rest:…`, `b2:…` or a path) and the password, in a file.
- For S3 and similar: the access credentials as `KEY=value` lines in a file, for example `AWS_ACCESS_KEY_ID=…`, `AWS_SECRET_ACCESS_KEY=…` and `AWS_DEFAULT_REGION=…`.
- A new server with a [supported operating system](https://www.berthpanel.app/library/system-requirements/). The same OS as the old server is simplest; another one works too (see below). Set up the VPN first, as for any [install](https://www.berthpanel.app/library/install/).
- Enough disk: roughly the size of all websites, mail and databases together, plus the largest customer once more. `berth dr plan` calculates it.

## The steps

1. **Install Berth** on the new server with the same host name as the old one:

   ```bash
   sudo berth install --hostname server.example.nl --php 8.3,8.2
   ```

2. **See what would come back.** This changes nothing on the server and writes nothing to the repository:

   ```bash
   sudo berth dr plan --repo s3:https://s3.example.com/acme-backups/berth \
     --password-file /root/repo-pw --env-file /root/repo-env
   ```

   You see the snapshot with the server settings, per subscription the source with its time and size, subscriptions without a source, and whether the disk is large enough. `--json` gives the same as JSON.

3. **Restore everything:**

   ```bash
   sudo berth dr restore --repo s3:https://s3.example.com/acme-backups/berth \
     --password-file /root/repo-pw --env-file /root/repo-env --yes
   ```

   `--yes` is required because the new server's panel database and configuration are overwritten. `--snapshot` picks an older snapshot than the newest; `--no-content` restores only configuration and accounts, without files, mail and databases. For a NAS, add `--cacert certificaat.pem`; for an SFTP repository with its own key, `--ssh-key-file`.

4. **Check the server:**

   ```bash
   sudo berth doctor
   ```

5. **Point the IP address (or DNS) at the new server.** If you take over the old address, customers do not change anything.

## What `berth dr restore` does

1. Stops the backup timer for the duration of the restore, so no schedule writes a half-restored server to the external place or prunes there, and pauses the panel and its other background timers while the panel database is imported. Then it connects the repository.
2. Before anything changes: compares the operating system in the backup with this one and resolves the questions (see below), picks the snapshot with the server settings, **measures the space needed** and stops if it does not fit. Then it puts the panel configuration, the archives and the key for sealed secrets in place, without an intermediate copy.
3. Imports the panel database and the database users with their password hashes. Users the new installation already has, such as the panel itself and webmail, keep their own password.
4. Runs `berth install --reconfigure` with the same PHP versions, groups and components as the old server, then webmail, the ionCube Loader where it was used, and the backup places that use the same repository.
5. Rebuilds everything from the database: system users with the same uids, websites, mail, FTP, cron jobs, hosted DNS with its DNSSEC keys, databases, object caches and suspensions, and per subscription the content from the newest source. The output ends with what you still need to do yourself.
6. Takes a new integrity baseline and switches the backup timer back on.

Certificates come along and renew themselves as usual afterwards.

### Where each subscription's content comes from

Per subscription, the restore takes the **newest** of three possible sources:

| Source | What it is | How it comes back |
|---|---|---|
| Archive | an archive from the copy of the archives | as an archive on the server, then the whole account over it |
| Direct snapshot | a snapshot from a schedule straight to the external place | fetched into the subscription's history, then the whole subscription restored over it |
| History copy | a copied moment of the local history | the same way |

Only content that belongs to *this* subscription counts: snapshots from before its creation date (of an earlier subscription with the same system user) are ignored. A subscription without any source gets a warning at the end: the account is back, without files, mail and databases. Per subscription, the output and the [audit trail](https://www.berthpanel.app/library/audit-trail-and-approvals/) record the source, the snapshot, its size and the outcome.

`berth dr plan` warns when a subscription's content is more than a day older than the panel database that comes back: what the customer removed since then would return, and what was added since would come back empty. Usually that is a schedule that lagged behind; choose an older `--snapshot`, or restore that subscription separately afterwards.

## Restoring onto a different operating system

A backup from Debian 13 can be restored on AlmaLinux or Rocky Linux 10, or Ubuntu 24.04 or 26.04, and every other direction. The backup records which system the old server ran. `berth dr plan` and `berth dr restore` compare it with the new server and:

- **translate automatically** whatever is unambiguous: paths, service names (`apache2` ↔ `httpd`), PHP package names (Sury ↔ Remi), the web server user, Postfix tables, the hosted DNS directory, SELinux labels on EL, MariaDB collations between versions, and an address with exactly one successor. The plan names every translation;
- **ask a question** with a proposal for whatever is not:

| Question (key) | When | Choices | Without an answer |
|---|---|---|---|
| `php:5.6` | a PHP version that cannot be installed here | a version that can (proposal: the next one up) | stops beforehand |
| `php:5.6@acme` | the same question for one subscription (answers file only) | a version | the version question applies |
| `extension:8.2:imagick` | an extension without a package for the target version | `overslaan` (skip), `stoppen` (stop) | stops beforehand |
| `image:acme/web` | a container image of another architecture | `opnieuw ophalen` (pull again), `uitzetten` (disable) | pull again |
| `local:nginx/custom.conf` | a custom snippet with a path that does not exist here | `uitzetten` (disable), `behouden` (keep) | disable |
| `address:192.0.2.10` | an address that is not on this server and has no clear successor | an address of this server, or `geen` (none) | stops beforehand |

Answer them in a file:

```bash
sudo berth dr plan --repo … --password-file /root/repo-pw --env-file /root/repo-env \
  --answers-template /root/answers.json
nano /root/answers.json   # review the proposals under "answers": key → answer
sudo berth dr restore --repo … --password-file /root/repo-pw --env-file /root/repo-env \
  --answers /root/answers.json --yes
```

Without `--answers`, `dr restore` asks in the terminal (Enter accepts the proposal). Without a terminal or a file, a question with a safe proposal goes ahead with that proposal; a question without one stops the restore **before anything changes**. All questions come before anything is restored, so a restore never stops halfway. The audit trail records both systems, every translation and every answer.

Changing a PHP version can break a site that relied on the old one, so check the sites afterwards. Network interfaces and extra addresses you set up yourself.

## From the browser on a fresh install

Prefer not to type on the server? After `berth install`, the first-setup page offers **Restore from an external backup**. You enter the setup code, choose the source (S3, an SFTP server or a NAS), fill in its details (for SFTP the private key, for a NAS also `certificaat.pem`), the repository password, optionally a snapshot, and whether the subscriptions' content comes along. The same `berth dr restore` then runs as a background job, with the same space check beforehand. The page shows the six steps and the log and refreshes itself, also while the panel restarts during step 4. Afterwards you sign in with your own account from the backup.

This route exists only on a server that has **never been configured**, and only with the setup code. As soon as an administrator exists, the form is gone. On a running server, use `berth dr restore`. If the backup comes from another operating system and has questions without a safe proposal, the browser route stops beforehand and lists them; then restore on the command line with an answers file.

Secrets you enter there appear in no argument, log line or error message, and are removed when the job ends.

## Restoring from a NAS

Use the repository address and password from `NOODHERSTEL.md` and add `--cacert certificaat.pem`. The new server must reach the NAS as the old one did (same tailnet, or its address allowed on the router). The NAS stays append-only during the restore; Berth only reads. See [Backing up to your own NAS](https://www.berthpanel.app/library/backup-to-nas/#restoring-from-the-nas).

## After an attack on the S3 backup

If someone deleted the backups with stolen keys, a versioned bucket with Object Lock still holds the data under delete markers. Roll the bucket back first, then restore as above:

```bash
sudo berth backup remote s3-restore --before "2026-10-20 02:00"          # count first
sudo berth backup remote s3-restore --before "2026-10-20 02:00" --apply  # then for real
sudo berth backup remote verify
```

This works within the lifecycle window shown on the place's page. See [Backing up to S3](https://www.berthpanel.app/library/backup-to-s3/#rolling-a-bucket-back-to-before-an-attack).

## What does not come back automatically

- **IP addresses and DNS**: point them at the new server, or move the address on the host.
- **The VPN**: set it up on the new server before restoring; a NAS or a source behind the VPN is otherwise unreachable.
- **The licence**: check *Licence* (`berth license status`) and activate again if asked; see [Licence and trial](https://www.berthpanel.app/library/licence-and-trial/).
- **Changes outside Berth**: packages Berth does not know, files in `/etc` outside the panel's own configuration, root's crontab, your own systemd units.
- **The local history**: fetch each subscription's moments back from the external place with `berth backup history pull --sysuser <user>`.
- **Places with their own credentials**: access to other backup places is deliberately not in the backup; enter their passwords and keys again under *Backups → Places*.
- **System apps and container images**: images are pulled again; the restore names what you need to set up again.
- **Logs, malware quarantine, spam-filter learning data and extensions** start empty; the ACME account is new, the certificates themselves come along.

Caches, temporary folders and backup-plugin output (for example `wp-content/cache`, UpdraftPlus and All-in-One WP Migration archives, Dovecot indexes) are deliberately left out of the history and direct snapshots. Dovecot rebuilds its indexes by itself.

## Only a few subscriptions

You do not need a full recovery to get one customer back:

- **Direct snapshots or history copies**: *Fetch from the external copy* on the subscription's history page (or `berth backup history pull --sysuser acme`), then restore from the history; see [Restoring data](https://www.berthpanel.app/library/restoring-data/).
- **Loose archives in S3**: `berth backup fetch` (also from another server), then restore the whole account with `berth backup snapshot`.
- **Moving a subscription to another Berth server**: use a transfer file; see [Importing backup files](https://www.berthpanel.app/library/import-backup-files/#moving-a-subscription-between-berth-servers).

## How long it takes

Count on about ten minutes for the fixed steps (install a few minutes, reconfigure and rebuild a few minutes), plus per subscription the download and the restore:

- **Downloading**: what the subscription takes in the repository (encrypted and compressed, usually half to two thirds of its size on disk), divided by the speed to the storage.
- **Restoring**: the size on disk divided by the write speed. Mail with many small files is slower.
- With a direct snapshot or a history copy, the snapshot goes into the subscription's history first and then into place, so the disk briefly needs about twice that subscription's size.

For a server with a little over 100 GB of websites, mail and databases, plan on one to one and a half hours, longer on a slow connection. The drill mentioned at the top took 79 minutes.

## Practising with a drill

Practise regularly, for example every quarter, on a **disposable server**. After `berth install` with the same host name as the real server:

```bash
sudo berth dr plan    --repo … --password-file /root/repo-pw --env-file /root/repo-env
sudo berth dr restore --repo … --password-file /root/repo-pw --env-file /root/repo-env --yes --drill
sudo berth doctor     # reports FAIL drill: that is expected
```

With `--drill`, the restore connects the repository **read-only**, without locks, so nothing is written to the real repository and the real server's cleanup does not have to wait. Right after the server settings are restored, the clone becomes a **practice server**, and nothing leaves it:

- the external backup is disconnected and all schedules, external places and customers' own storage are off, and stay off even if someone switches a schedule on;
- **all mail is held** in the queue, including what was already there; nothing is delivered, not even notifications to customers (`postqueue -p` shows it);
- notification channels receive nothing; the notification log marks them as held;
- no licence activation or update check: the real licence is never reported from the clone;
- no certificate requests or renewals; the certificates from the backup stay;
- no uptime checks, no DNS provider or CDN changes, no secondary DNS, no log drains or SIEM, no address takeover, no migration source;
- customers' cron jobs do not run, [Fleet](https://www.berthpanel.app/library/fleet/) is idle and webhooks deliver nothing;
- `berth doctor` reports FAIL drill and every page shows a red banner: *Practice server: do not put into use*.

Reading lists (vulnerability data, GeoIP, package sources) and signing in through SSO keep working. Customers' own sites can still call out if you open them, so only open them to look.

Check sites (with `curl --resolve` or a hosts entry), mail and databases, write down the timings for your own runbook, then throw the server away. There is deliberately no way back from a practice server to a real one: a real replacement is restored without `--drill`.

## Related

- [How backups work](https://www.berthpanel.app/library/backups-overview/)
- [Restore tests](https://www.berthpanel.app/library/restore-tests/)
- [Disks and snapshots](https://www.berthpanel.app/library/disks-and-snapshots/)
- [NIS2 and incidents](https://www.berthpanel.app/library/nis2-and-incidents/)
