remote-backups.comremote-backups.com
Contact illustration
Sign In
Don't have an account ?Sign Up

PBS Host Backup: Config, Keys, Reinstall

Your Proxmox Backup Server protects every VM and container. But who protects the backup server? If its boot disk fails, the snapshots on the datastore disks are usually still there. What you lose is the configuration: users, API tokens, permissions, remotes, sync jobs, prune and verify jobs, notification targets and the TLS certificate. This post shows what to back up on a PBS host, where the encryption keys really are, and how to attach the existing datastores to a new installation.

Key Takeaways
  • All PBS configuration files are in /etc/proxmox-backup/. The datastore contents are not in this directory.
  • Client-side encryption keys are not stored on the PBS host. They are on the clients, for example in /etc/pve/priv/storage/<STORAGE-ID>.enc on Proxmox VE.
  • Tape encryption keys are managed on the PBS host. Print them with proxmox-tape key paperkey.
  • After a reinstall, add each datastore again with the reuse option, then run a verify and test a restore.
  • Send the host backup to a different PBS. A backup that is stored only on the same host is lost with the host.

What is on a PBS host

A PBS host has two types of data:

  • Datastore contents. The chunks and snapshot indexes are on the datastore path, for example /mnt/datastore/<name>, or in an S3 bucket. This data is often on separate disks.
  • Host configuration. The documentation of PBS 4.2.10 states that all configuration files are in /etc/proxmox-backup/. The network configuration is in /etc/network/interfaces, as on other Debian systems.

This post covers the second type. The datastore contents need their own copy, for example a sync job to a second PBS.

Files in /etc/proxmox-backup

The docs list these configuration files:

  • datastore.cfg: datastores and their options.
  • user.cfg and acl.cfg: users, API tokens and permissions.
  • domains.cfg: authentication realms.
  • remote.cfg and sync.cfg: remote servers and sync jobs.
  • prune.cfg and verification.cfg: prune jobs and verify jobs.
  • notifications.cfg and notifications-priv.cfg: notification targets and matchers. The private file holds the secrets of SMTP, Gotify and webhook targets.
  • tape.cfg, tape-job.cfg and media-pool.cfg: tape drives, tape jobs and media pools.
  • node.cfg: node settings.

Some files in the same directory hold secrets:

  • shadow.json: the password hashes of users in the pbs realm.
  • token.shadow: the secrets of API tokens.
  • proxy.pem and proxy.key: the TLS certificate and its private key.

Users of the pam realm, for example root@pam, are Linux users. Their passwords are in /etc/shadow, not in /etc/proxmox-backup/.

Where the encryption keys are

PBS uses client-side encryption. The client encrypts the data before it sends it, so the server never gets the key. The PBS FAQ also states that encryption is not enabled by default.

So a backup of the PBS host does not contain the keys of your encrypted backups. The keys are on the clients:

  • Proxmox VE: /etc/pve/priv/storage/<STORAGE-ID>.enc, one file for each PBS storage.
  • proxmox-backup-client: the default key is ~/.config/proxmox-backup/encryption-key.json, unless you use --keyfile.

The Proxmox VE documentation is clear about the risk: "Without their key, backups will be inaccessible." Keep a copy of each key outside the system that it protects, for example as a paper key:

bash
proxmox-backup-client key paperkey /etc/pve/priv/storage/<STORAGE-ID>.enc --output-format text > qrkey.txt
Print a client key as a paper key (on the PVE host)

PBS Client-Side Encryption: AES-256-GCM explains master keys and paper keys in more detail.

Tape keys are on the server

Tape encryption is different. PBS manages tape encryption keys on the backup server (Tape Backup > Encryption Keys). Print each key with proxmox-tape key paperkey <fingerprint> --output-format text. The docs also describe how to restore a key from a tape with its password: proxmox-tape key restore.

Back up the host configuration

The proxmox-backup meta package depends on proxmox-backup-client, so the client is normally installed on a PBS host. If it is not, install it with apt install proxmox-backup-client.

Send the backup to a different PBS, not to the host itself. A good target is the offsite PBS that already receives your sync jobs. Create a separate API token with backup permission on the target, and put the connection details in a file that only root can read:

bash
PBS_REPOSITORY='hostbackup@pbs!pbs01@offsite.example.com:hostconfig'
PBS_PASSWORD='<api-token-secret>'
PBS_FINGERPRINT='<sha256-fingerprint-of-the-target>'
/etc/pbs-host-backup.env (chmod 600)

Then back up /etc. This includes /etc/proxmox-backup/ and the network configuration:

bash
set -a; . /etc/pbs-host-backup.env; set +a
proxmox-backup-client backup etc.pxar:/etc --backup-id pbs01 --keyfile /root/pbs-host-backup.key
Back up /etc of the PBS host

The archive contains shadow.json, token.shadow and proxy.key. Encrypt it. Create the key with proxmox-backup-client key create /root/pbs-host-backup.key before the first run. Then store a copy of this key outside the PBS host. If the key exists only on the host, you lose it together with the host.

Also save a short record of the storage layout. You need it to attach the disks again:

bash
proxmox-backup-manager datastore list
lsblk -o NAME,SIZE,FSTYPE,UUID,MOUNTPOINT
proxmox-backup-manager cert info
Record the storage layout

The last command shows the fingerprint of the current certificate. To run the backup every night, use a systemd timer. Proxmox VE Host Backup and Node Rebuild shows a service and timer unit for the same pattern.

Rebuild after a reinstall

Loading...
Rendering diagram...
Recovery order for a PBS host

Step 1: Install PBS

Install Proxmox Backup Server from the ISO on the new boot disk. Select only the boot disk as the target in the installer. The installer formats the disks that you select, so do not select your datastore disks. Then set the same IP address and hostname as before.

Step 2: Restore the archive to a temporary path

Restore the /etc archive to a temporary path, not directly to /etc. The env file and the key were on the old host. Copy the key from your offsite copy to /root/pbs-host-backup.key, and create /etc/pbs-host-backup.env again. Then restore the archive:

bash
set -a; . /etc/pbs-host-backup.env; set +a
proxmox-backup-client snapshot list host/pbs01
proxmox-backup-client restore host/pbs01/<timestamp> etc.pxar /root/etc-restore --keyfile /root/pbs-host-backup.key
Restore the /etc archive to a temporary path

The files are now in /root/etc-restore/proxmox-backup/. Use datastore.cfg from there to see the old datastore names and paths.

Step 3: Add the datastores with the reuse option

Attach the datastore disks and mount them at the old path. Then add each datastore again. In the web interface, enable Reuse existing datastore when you add the datastore. On the CLI, use --reuse-datastore true:

bash
proxmox-backup-manager datastore create store1 /mnt/datastore/store1 --reuse-datastore true
Add an existing datastore

Use the old name. Permissions use paths such as /datastore/store1, and jobs and Proxmox VE storage entries refer to the datastore by name. Two special cases are in the docs:

  • Removable datastores: add the datastore with Reuse existing datastore enabled and the same relative path that you set on creation.
  • S3 datastores: pass --reuse-datastore true and --overwrite-in-use true. The datastore name must be the same, because PBS uses it as a prefix in the bucket.

Step 4: Restore users, tokens, remotes and jobs

The docs do not give a procedure to copy back the full /etc/proxmox-backup/ directory. The steps below are our approach, not a documented procedure. Copy back only the files that you need, one by one. Do not copy datastore.cfg from the archive: keep the new file from Step 3. Copy the files as root, keep the owner and the file mode of the original files, and restart the services after the copy:

bash
systemctl restart proxmox-backup proxmox-backup-proxy
Restart the PBS services

Then check the result in the web interface: users and tokens, permissions, remotes, sync jobs, prune and verify jobs, and notification targets. Test this procedure on a test VM before you need it.

Step 5: Certificate and fingerprint

Proxmox VE and other clients can pin the certificate fingerprint of the PBS host. A new installation creates a new self-signed certificate, so pinned clients stop working. You have two options:

  • Copy back proxy.pem and proxy.key, then run systemctl restart proxmox-backup-proxy. The docs use the same two steps for a custom certificate. The old fingerprint then stays valid.
  • Keep the new certificate and update the fingerprint on each client. proxmox-backup-manager cert info shows it.

If you use ACME with a trusted certificate, clients that do not pin a fingerprint continue to work after a new certificate is issued.

Check the data before you trust it

A datastore that Proxmox Backup Server shows again is not yet a tested datastore. Disks can have errors after a failure, and a wrong mount can show an empty or old directory. Do two checks:

  1. Verify. Start a verify job on each datastore, or run it on the CLI:
bash
proxmox-backup-manager verify store1
Verify all snapshots in a datastore
  1. Test a restore. Restore one VM to a test ID, and restore single files from one host backup. Encrypted snapshots also need the client key. This is a good test that the key copy works.

PBS Verify Jobs: Catch Silent Corruption explains what a verify job checks, and PBS Restore Testing: A Practical Guide to DR Drills has a plan for restore tests.

Common mistakes

  • The host backup is on the same host. Use a second PBS as the target.
  • The key for the host backup is only on the host. Store a paper copy or a copy in a vault.
  • No copy of the client keys. A PBS host backup does not contain them.
  • The installer formats a datastore disk. Remove the datastore disks before the install, or check the target disk again before you start.
  • A new datastore name. Permissions, jobs and PVE storage entries still use the old name.
  • No verify after the reinstall. Verify first, then send new backups.

Wrapping up

Back up /etc of the PBS host to a different PBS, encrypt the archive, and keep the key outside the host. Keep copies of the client keys and the tape keys. After a reinstall, add the datastores with the reuse option, restore the configuration, fix the certificate, and verify the data before you trust it.

Add an offsite datastore to your PBS

The docs show how to connect your PBS with a remote-backups.com datastore.

Read the PBS setup docs

The PBS 4.2 documentation states that all configuration files are in /etc/proxmox-backup/. The datastore contents are on the datastore paths or in the S3 bucket, not in this directory.

No. PBS uses client-side encryption, and the server does not get the key. The keys are on the clients, for example in /etc/pve/priv/storage/<STORAGE-ID>.enc on Proxmox VE. Tape encryption keys are an exception: PBS manages them on the server.

Yes. Add it with Reuse existing datastore in the web interface, or with --reuse-datastore true on the CLI. Use the old name. S3 datastores also need --overwrite-in-use true.

The new installation has a new self-signed certificate, so the pinned fingerprint does not match. Copy back proxy.pem and proxy.key, or update the fingerprint in the PVE storage configuration.

Do not assume it. Run a verify on each datastore and test a restore before you rely on it.
Bennet Gallein
Bennet Gallein

remote-backups.com operator

Infrastructure enthusiast and founder of remote-backups.com. I build and operate reliable backup infrastructure powered by Proxmox Backup Server, so you can focus on what matters most: your data staying safe.