โ๏ธ Offsite Backup with Backblaze B2
This guide explains how to securely sync encrypted Proxmox Backup Server (PBS) backups to Backblaze B2 using rclone
. It includes scripting, logging, cron automation, and tips to keep costs in check.
1. ๐ง Rclone Setup
Install rclone on your PBS VM:
curl https://rclone.org/install.sh | bash
Configure a remote for B2:
rclone config
- Name:
b2pbs
- Type:
Backblaze B2
- Account ID and Application Key from B2 console
Create a B2 bucket, e.g., packetrealm-backup-bucket
.
Test:
rclone lsf b2pbs:packetrealm-backup-bucket
2. ๐ PBS Backups Are Already Encrypted
If you’ve enabled encryption in PBS:
- Files on disk and in B2 remain encrypted
- No need to encrypt again with rclone
3. ๐ Rclone Sync Script
Save this script as /usr/local/sbin/rclone-b2-sync.sh
:
#!/bin/bash
# Author: Hilton D'silva (packetrealm.io)
# Purpose: Sync PBS encrypted backups to Backblaze B2
SRC="/mnt/pbs-data/"
DEST="b2pbs:packetrealm-backup-bucket/proxmox-backup-sync/"
DATE=$(date +%Y-%m-%d)
LOGFILE="/var/log/rclone-b2-${DATE}.log"
rclone copy "$SRC" "$DEST" \
--transfers=1 \
--checkers=2 \
--contimeout=60s \
--timeout=5m \
--retries=10 \
--low-level-retries=10 \
--bwlimit=3M \
--log-file="$LOGFILE" \
--progress \
--verbose
Make it executable:
chmod +x /usr/local/sbin/rclone-b2-sync.sh
4. โฐ Automate with Cron
Edit the crontab:
crontab -e
Add a nightly sync at 2 AM:
0 2 * * * /usr/local/sbin/rclone-b2-sync.sh
5. ๐งพ Optional: Log Rotation
Create /etc/logrotate.d/rclone-b2-sync
:
/var/log/rclone-b2-*.log {
daily
rotate 14
compress
missingok
notifempty
copytruncate
}
Test it:
logrotate -d /etc/logrotate.d/rclone-b2-sync