# Restore tests

> Berth regularly restores a backup into a sealed sandbox, imports the databases, counts the mail and requests every site, so you know your backups work before you need them.

Source: https://www.berthpanel.app/library/restore-tests/ · Category: backup · Updated: 2026-10-29

A backup you have never restored is a hope, not a backup. Berth therefore tests restores on a schedule: it takes a real backup, restores it where it cannot touch anything live, and checks that the result works. This article explains what is tested for each kind of place, how to run and follow a test, and how to go further with a full disaster-recovery drill.

## What a restore test does

For archives, the test restores an archive into an isolated **sandbox** and checks every part of it:

1. **Choose an archive** from the schedule's run (or the newest archive of a random subscription).
2. **Check the archive and prepare the sandbox.**
3. **Unpack** the archive as an unprivileged user. Live webspaces, databases and mailboxes are never touched.
4. **Files**: check the unpacked webspaces.
5. **Databases**: import each database as a temporary copy and count its tables.
6. **Mail**: count the mailboxes and messages.
7. **Sites**: request every site through a PHP server inside the sandbox.
8. **Clean up**: the sandbox, the temporary databases and their users are removed.

Each step ends as *succeeded*, *failed* or *skipped* (with the reason, for example a site that cannot be requested safely). The verdict and every check are stored with the test.

The test is background work. It runs at low priority, and archive and dump reads are throttled, so the panel and the sites stay responsive. A large archive simply takes longer.

## What is tested per place

Tests are set per schedule, so each place is tested with what that schedule actually made. You find the overview under *Backups → Schedules* when editing a schedule, under *What is tested per place*.

| Place | What the test does |
|---|---|
| *Archives on this server* | a random archive from the run, restored in the sandbox as described above |
| *External: loose archives (S3)* | a random archive from the run, tested on this server before it is uploaded |
| *History on this server* | for a random subscription: `restic check` on a sample of the data, and one file or database dump from the newest moment restored into a temporary folder |
| *External: moments, encrypted and deduplicated* (S3, NAS, SFTP, …) | `restic check` on part of the data, and one file or database dump from this schedule's newest snapshot fetched back into a temporary folder |

For external deduplicated places the check reads a different twelfth of the data each day. With a weekly test, every byte in the repository has been read back once after twelve weeks; with a daily test, after twelve days. A fixed random sample would leave some data unread forever.

For loose S3 archives, *Check now* on the place confirms that the bucket is reachable and readable.

## Setting the frequency

Each schedule has a *Restore test* field: never, after every run, daily, weekly or monthly.

```bash
berth backup schedule add --name "Everything nightly" --location server \
  --schedule daily --hour 1 --minute 30 --keep 7 --test weekly
```

If no schedule asks for a test, Berth still tests the newest archive of a random subscription once a week, early in the morning.

## Running a test by hand

On *Backups*, the card **Restore test** shows the last result and a strip of recent tests. **Test now** starts one, for a chosen subscription or a random one.

While it runs, the task bar at the top of the page shows which subscription and archive are being tested and the current step (while unpacking, with the share of the archive read so far). **Details** lists every step with its result and explanation. **Stop…** aborts at the next step: whatever is running is stopped and the sandbox and temporary databases are removed. A stopped test does not count in the history and sends no notification. If the panel or the server stops during a test, it is marked *aborted*.

```bash
berth backup restore-test --sysuser acme        # test now, steps on screen, report as JSON
berth backup restore-test status --wait         # follow a running test, also one the panel started
```

## Checking a place

Every place has **Check now** on its page, or:

```bash
berth backup location verify <place-id>
berth backup remote verify --location <place-id>
```

For a deduplicated place this runs `restic check` and restores a file or database dump as a test. If a copy or a NAS cleanup holds the repository at that moment, the check waits a while and then reports "busy, try again later" instead of an error. Cleanup of old snapshots is postponed while a check or test uses a place, so a test never races against pruning.

The place's page also shows its health: last successful run, last error, last check or restore test with the outcome and the explanation, and how much space it uses.

## Built-in checks around the copy

Some guarantees are checked on every run, not only during tests:

- **NAS**: before each copy, Berth checks that the rest-server still refuses deletion (append-only). If it does not, you get a warning and a notification. See [Backing up to your own NAS](https://www.berthpanel.app/library/backup-to-nas/).
- **S3 with Object Lock**: with *Only copy if the bucket locks*, a run refuses to write to a bucket without a lock. See [Backing up to S3](https://www.berthpanel.app/library/backup-to-s3/).
- **Customer data**: an external run without any customer data is reported as a warning, not as a success. See [How backups work](https://www.berthpanel.app/library/backups-overview/#does-all-customer-data-actually-leave-the-server).

## Failed tests and alerts

A failed test arrives as the notification *Restore test failed* through your [notification channels](https://www.berthpanel.app/library/notifications-and-alerts/), with the step that failed and why. The result is also visible on the place's page and in the schedule's last runs. Fix the cause and run **Test now** again.

Restore tests and their outcomes are part of the monthly reports and of the evidence you can hand to an auditor; see [Evidence for audits](https://www.berthpanel.app/library/evidence-for-audits/).

## Going further: a disaster-recovery drill

A restore test proves that individual backups can be read and restored. To prove you can rebuild a whole server from the external copy alone, run a drill: install Berth on a disposable server and restore everything with `berth dr restore --drill`. The clone becomes a practice server on which all mail is held and nothing reaches the outside world. We recommend doing this every quarter. See [Disaster recovery](https://www.berthpanel.app/library/disaster-recovery/#practising-with-a-drill).

## Related

- [Restoring files, mail and databases](https://www.berthpanel.app/library/restoring-data/)
- [How backups work](https://www.berthpanel.app/library/backups-overview/)
