This can be used to check the status of all backups in batch:
```sh
for stanza in$(ls /var/lib/pgbackrest/backup );do
echo checking $stanza
hostname=$(basename$stanza .torproject.org)
sudo-u pgbackrest-$hostname pgbackrest --stanza=$stanza info
done
```
It's essentially the same as the first, but with `info` instead of
`check`.
## pgBackRest backup recovery
pgBackRest is our new PostgreSQL backup system. It features [restore
procedure](https://pgbackrest.org/user-guide.html#quickstart/perform-restore) and [restore command](https://pgbackrest.org/configuration.html#section-restore), and [detailed restore
procedures](https://pgbackrest.org/user-guide.html#restore), which includes instructions on how to restore a
specific database in a cluster, do [point in time recovery](https://pgbackrest.org/user-guide.html#pitr), to go
back to a specific time in the past.
### Simple latest version restore
The procedure here assumes you are restoring to the latest version in
the backups, overwriting the current server.
1. visit the right cluster version:
cd /var/lib/postgresql/15/
1. stop the server, and keep it from starting:
service postgresql.service stop
sudo -u postgres rm main/global/pg_control
2. move or remove all files from the old cluster, alternatively:
mv main main.old && sudo -u postgres mkdir --mode 700 main
or to remove all files:
find main -mindepth 1 -delete
You should typically move files aside unless you don't have enough
room to restore while keeping the bad data in place.