Backup a Physical Machine to Proxmox Backup Server

Backup a Physical Machine to Proxmox Backup Server
Photo by Markus Spiske

The following instructions allow you to do a file level backup of a Debian based AMD64 system that doesn't need to be a Proxmox VM. This can be used for separate servers or even your Proxmox hosts themselves.

Installation

Start by getting the GPG key

wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg

Then add the APT repository to your system

echo "deb http://download.proxmox.com/debian/pbs-client buster main" >> /etc/apt/sources.list.d/pbs-client.list

Then update your APT cache

apt update
You may need to install libssl1.1 manually before the next command will work correctly. You can download this below.

Finally install Proxmox Backup Client

apt install proxmox-backup-client

Backup Script

You'll then need a script to backup to your PBS server

#!/bin/bash

export PBS_PASSWORD=''
export PBS_USER_STRING=''
export PBS_SERVER=''
export PBS_DATASTORE=''
export PBS_REPOSITORY="${PBS_USER_STRING}@${PBS_SERVER}:${PBS_DATASTORE}"
export PBS_HOSTNAME="$(hostname -s)"
echo "Running Backup for $PBS_HOSTNAME ..."
proxmox-backup-client backup root.pxar:/
echo "Done."

Explanation

  • PBS_PASSWORD is the PBS API Token that you generate in PBS to authenticate with the server. You'll need to go over to the Permissions tab in PBS and ensure you give the API Token the role DatastoreBackup.
  • PBS_USER_STRING is the PBS API User. This is again generated in PBS and looks similar to this root@pam!Server
  • PBS_SERVER is the IP address or DNS name of the PBS server
  • PBS_DATASTORE is your datastore name in PBS
  • PBS_HOSTNAME is your clients hostname. This can be left alone as it just takes the hostname from your system and passes it in
  • The / on the end of proxmox-backup-client backup root.pxar:/ defines the directory to backup. For example if you wanted to backup just /srv then you would change this to proxmox-backup-client backup root.pxar:/srv/