Skip to content

Instantly share code, notes, and snippets.

@sdellysse
Last active April 7, 2025 20:24
Show Gist options
  • Save sdellysse/8c4259e27142f159712901325c282558 to your computer and use it in GitHub Desktop.
Save sdellysse/8c4259e27142f159712901325c282558 to your computer and use it in GitHub Desktop.
Proxmox Backup Client setup
export PBS_HOST="10.69.4.20"
export PBS_PORT="8007"
export PBS_USERNAME="root@pam"
export PBS_PASSWORD="totallymyrealpassword"
export PBS_DATASTORE="tank"
export PBS_NAMESPACE="backups"
export PBS_FINGERPRINT="fi:ng:er:pr:in:ts:ar:en:ts:ec:re:tb:ut:im:ch:an:gi:ng:it:an:yw:ay"
export PBS_REPOSITORY="${PBS_USERNAME}@${PBS_HOST}:${PBS_PORT}:${PBS_DATASTORE}"
export PXAREXCLUDE="
*
!/.pbc-config.sh
!/etc
!/etc/cron.hourly
!/etc/cron.hourly/pbc-backup
!/usr
!/usr/local
!/usr/local/bin
!/usr/local/bin/**
!/other_files_here
"

Proxmox Backup Client setup

I have a few hosts that I need to have as bare-metal debian installs for reasons I won't go into. This gistpack is here to remind me and explain to the world how I set up my baremetal hosts to back up to my proxmox backup server.

I create a file in the root of the filesystem, /.pbc-config.sh. This hold all the proxmox backup client env vars, along with the list of files to include in the root backup. The /usr/local/bin/pbc-backup script is the actual worker. /etc/cron.hourly/pbc-backup runs the prior script every hour.

Obviously this is all adjust-as-needed. Hope someone finds this useful!

#!/usr/bin/env bash
set -euo pipefail
exec /usr/bin/cronic /usr/local/bin/pbc-backup
#!/usr/bin/env bash
set -euo pipefail
if [ "$UID" -ne "0" ]; then
echo "must run as root or in sudo"
exit 1
fi
if [ "$( stat -c '%a' /.pbc-config.sh )" -ne "600" ]; then
echo "permissions on /.pbc-config.sh need to be 600"
exit 1
fi
source /.pbc-config.sh
echo "$PXAREXCLUDE" > /.pxarexclude
echo "created '/.pxarexclude'"
proxmox-backup-client backup --ns="$PBS_NAMESPACE" root.pxar:/ 2>&1
rm -vf /.pxarexclude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment