Offsite Proxmox Backup Server with S3 Storage

Self-Hosting Feb 20, 2024

In this post, we'll be deploying Proxmox Backup Server (PBS) on a Debian 12 VPS and storing the backups on Scaleway S3 compatible storage.

Warning
If deploying on a cloud VPS, it's probably best to not directly expose this to the internet. Here are some safer ways to connect:

Things to note:

  • Initialisation of the Datastore took me 19 Hours
  • Backing up with Encryption is recommended
  • 8 fairly minimal Debian VM's only used 14GB of storage with ZSTD compression.

Installing Proxmox Backup Server on Debian 12

Follow the official docs or use our simplified version below.

Add Proxmox Repositories

wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

Validate SHA256 Hash
sha512sum /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

Expected output:
7da6fe34168adc6e479327ba517796d4702fa2f8b4f0a9833f5ea6e6b48f6507a6da403a274fe201595edc86a84463d50383d07f64bdde2e3658108db7d6dc87

If your output is not the above, validate with the official docs.

Add to apt sources
sudo nano /etc/apt/sources.list
Paste the following:

deb http://download.proxmox.com/debian/pbs bookworm pbs-no-subscription

Install

sudo apt update
sudo apt install proxmox-backup-server

Set root password:

sudo proxmox-backup-manager user update root@pam --password SecurePassword

Reboot
sudo reboot

Login
https://IP:8007

Configuring S3 Backend

PBS does not support S3 storage for a Datastore, however we can make it work by using s3fs.

Install s3fs
sudo apt install s3fs

Add Credentials
sudo nano /etc/passwd-s3fs

Add the folowing line to the file, using your creds.
ACCESS_KEY_ID:SECRET_ACCESS_KEY

Set Permissions
sudo chmod 600 /etc/passwd-s3fs

Create mount point location
sudo mkdir /mnt/pbs-s3

Connect to S3
With debug on:
sudo s3fs YOUR-BUCKET /mnt/pbs-s3 -o allow_other -o passwd_file=/etc/passwd-s3fs -o url=https://s3.nl-ams.scw.cloud -o use_path_request_style -o endpoint=nl-ams -o parallel_count=15 -o multipart_size=128 -o nocopyapi -o dbglevel=info -f -o curldbg

Make sure it all works ok, with a 200 response and you can touch text.txt into /mnt/pbs-s3 without issues.

Connect on boot
Ideally you'd use fstab for this however I kept running into issues setting this up. I resulted in using a cron @restart script to set it up on boot.

Create Boot up script
nano s3-mount.sh

Paste in your connect command above

Add execute permissions
sudo chmod u+x s3-mount.sh

Sudo crontab
sudo crontab -e

Enter the following:
@reboot /bin/sh /home/YOUR-USER/s3-mount.sh

Proxmox Configuration

In Proxmox Backup Server, click "Add Datastore" (bottom of the left panel). Fill in the details:

After clicking add it can take some time to create the Datastore, and I mean a crazy long time. Took just over 19 hours for me after writing 65,539 empty directories to disk.

Scaleway S3 Bucket Stats

PBS Setup in Proxmox Hypervisor

On your Proxmox Hypervisor head to Datacenter > Storage > Add > Proxmox Backup Server

Fill in the details:
As you are storing your VM's on the cloud you'll probably want to enable Encryption for your backups to keep them secure. Just make sure you keep the key safe!

Back in Proxmox Backup Server click "Show Fingerprint"
Paste this in the Fingerprint field on Proxmox Hypervisor

Then create you're backups under the Backup tab within Proxmox Hypervisor. These are going to take a fair bit longer than local storage due to the upload and overhead of S3.

That's it! It's worth perdiodically checking in to ensure everything is being backed up as expected.

Follow the Blog on Mastodon: @[email protected]

Tags