Skip to content

Host Backup

This solution uses the proxmox-backup-client for creating the backup on an remote Proxmox Backup Server.

Prepare

Create an user for the Backups on the PBS. This user requires the DatastoreBackup permission on the Namespace in your Datastore, ex. `/datastore/hdd01/demo.

Encryption Key

If you have no Key, from VM Backups, you can create a new one with proxmox-backup-client key create <Path to keyfile> --kdf none.

If you want to reuse an existing key you can find the key generatet over the GUI under /etc/pve/priv/storage/.

Example script

#!/bin/bash

BACKUP_USER="<User>@<Realm>"
BACKUP_SERVER="<Backup server>"
BACKUP_DATASTORE="<Backup datastore>"
BACKUP_NAMESPACE="<Backup namespace>"
BACKUP_ENCRYPTION_KEY="<Path to encryption key>"

export PBS_PASSWORD_FILE="<Path to user password file>"
export PBS_REPOSITORY="${BACKUP_USER}@${BACKUP_SERVER}:${BACKUP_DATASTORE}"

echo "Check if encryption Key exists"

if [ -f ${BACKUP_ENCRYPTION_KEY} ]; then
    echo "Encryption key found"
else
    echo "No encryption key found"
    echo "Create key with: proxmox-backup-client key create ${BACKUP_ENCRYPTION_KEY} --kdf none"
    exit 1
fi

echo "Create Backup"
proxmox-backup-client backup \
    root.pxar:/ \
    --include-dev /etc/pve \
    --exclude /tmp \
    --ns ${BACKUP_NAMESPACE} \
    --keyfile ${BACKUP_ENCRYPTION_KEY}