Copy backup from PBS datastore to S3FS

mlazzarotto

Member
Dec 30, 2021
24
8
8
33
I'm using an S3-compatible cloud storage (Idrive E2) and I'd like to use it to keep a copy of my backups.
I've mounted the bucket using S3FS, but since I can't use that as a PBS datastore, I was wondering if I can extract the backups from PBS and copy them to the S3FS mounted folder in a similar way as I would copy a dump from PVE.

I do have the option to sync all the PBS files (chunks) but my datastore (1.5TB) is bigger than my account capacity (1TB), so that's not an option.
 
Hi!
this is not really possible, as the backups are stored in chunks, which are deduplicated. This means that multiple backups can refer to the same chunk; so you have to copy the whole chunk store, otherwise it won't work. (https://pbs.proxmox.com/docs/technical-overview.html.)

But I would add the s3fs mount as a datastore to PBS, then sync some backups from one datastore to the s3fs one.
 
But I would add the s3fs mount as a datastore to PBS, then sync some backups from one datastore to the s3fs one.
I wish I could, but there's something wrong with the Idrive implementation of their S3 "version" that messes up with the creation of the chunks.

Anyway, I guess my next step will be to add the s3fs mount to my Proxmox VE and use that to store the backups (in addition to PBS).
 
@ggoller
The s3fs mount may fail for the most weird issue. To prevent the backup job from filling the disk space, I think that I can use a hook script to check the mount. If the mount fails, how can the hook script terminate the backup job?
 
Hi,

most bucket based object storages like S3 or B2 do not support the concept of empty directories (according to rclone mount). Thus if you try to create a chunk, but the folder is not there so it fails.
If I create the missing folders, my sync jobs work, otherwise I get an error, of not being able to insert a chunk.
Not sure, if the hook script is the best way or just run mkdir {{0..9},{a..f}}{{0..9},{a..f}}{{0..9},{a..f}}{{0..9},{a..f}} in the .chunks folder via cron job.

Best regards,
Karl-Heinz
 
  • Like
Reactions: mlazzarotto
Hi,

most bucket based object storages like S3 or B2 do not support the concept of empty directories (according to rclone mount). Thus if you try to create a chunk, but the folder is not there so it fails.
If I create the missing folders, my sync jobs work, otherwise I get an error, of not being able to insert a chunk.
Not sure, if the hook script is the best way or just run mkdir {{0..9},{a..f}}{{0..9},{a..f}}{{0..9},{a..f}}{{0..9},{a..f}} in the .chunks folder via cron job.

Best regards,
Karl-Heinz
Thanks, I'll try to create the folders
 
I ended up using a hook script made in shell to check if the folder is mounted and stop the backup job if is not.
Bash:
#!/bin/bash

mountpoint="/mnt/idrive_e2"
trimmed_dumpdir=$(dirname "$DUMPDIR")

# if backup is starting and if mountpoint is not mounted and if we're backing up to Idrive
if [[ $1 == "backup-start" ]] && ! mountpoint -q "$mountpoint" && [[ "$mountpoint" == "$trimmed_dumpdir" ]]; then
    echo "Error: $mountpoint is not a mounted mountpoint. Killing vzdump"
    # kill vzdump process
    killall -q -r "task UPID:\w+:[a-zA-Z0-9]+:[a-zA-Z0-9]+:[a-zA-Z0-9]+:vzdump:\d+:\w+@\w+"
fi
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!