Swap backup drives

t0mz

Member
Jan 20, 2022
42
6
13
25
My backups go to an external drive which is mounted to /media/backup. What I try to achieve is that I replace this drive with a different one whenever appropriate and have PBS continue to use that drive. The new drive might be empty or a hold an older version of the datastore.
Now, it turns out that things aren't that easy. It seems I have to manually recreate the on-drive parts of the repository, folder structure, namespaces, etc. Which is ok, because I can script this.
However, I am stuck now with the below and wonder if I might be hitting a security token issue making what I want to do impossible?

Code:
INFO: Error: inserting chunk on store 'BackupDrive' failed for 88885c27a95d2b841e24a1f8030ab3b25c9
c6714e3b0a368afdc7910419863af - mkstemp "/media/backup/PBS/.chunks/8888/88885c27a95d2b841e24a1f8030ab3b25c9c6714e3b0a368afdc7910419863af.tmp_XXXXXX" failed: ENOENT: No such file or directory

INFO: cleanup temporary 'vzdump' snapshot

ERROR: Backup of VM 102 failed - command 'lxc-usernsexec -m u:0:100000:65536 -m g:0:100000:65536 -- /usr/bin/proxmox-backup-client backup '--crypt-mode=none' pct.conf:/var/tmp/vzdumptmp3333297_102/etc/vzdump/pct.conf root.pxar:/mnt/vzsnap0 --include-dev /mnt/vzsnap0/./ --skip-lost-and-found '--exclude=/tmp/?*' '--exclude=/var/tmp/?*' '--exclude=/var/run/?*.pid' --backup-type ct --backup-id 102 --backup-time 1762935038 --entries-max 1048576 --repository root@pam@172.20.0.2:BackupDrive --ns PVE2' failed: exit code 255

INFO: Failed at 2025-11-12 09:10:40

INFO: Backup job finished with errors

INFO: notified via target `mail-to-root`

TASK ERROR: job errors

The folder structure is there, /media/backup/PBS is owned by backup:backup. I was able to recreate the namespaces through the UI, which I guess means the service is able to write to that folder structure in principle.

I could of course delete and recreate the datastore, but that would mean new fingerprints and updating all clients which I don't want to do.
Anyone got an idea what might be missing still, or an alternative approach to achieve my goal of multiple alternating backup drives?
 
Doesn't really help for my use case I am afraid.
In the meantime I tried to rsync the PBS file structure over to the new drive (excluding .chunks) but that didn't do the trick either.
I probably need the next level below .chunks as well as this is where I am stuck now.
I created a few of these 4 char directories manually but it just keeps on coming up with the next one missing.

Code:
INFO: Error: inserting chunk on store 'BackupDrive' failed for 45c6cdbda493d9ea646c6ea6b475a3ca35a7543895568b84050ee630fac2013d - mkstemp "/media/backup/PBS/.chunks/45c6/45c6cdbda493d9ea646c6ea6b475a3ca35a7543895568b84050ee630fac2013d.tmp_XXXXXX" failed: ENOENT: No such file or directory

Edit:
I meanwhile made progress:
1. Run a script which creates the subdirs in .chunks
Code:
for i in $(printf "%04x\n" {0..65535}); do           
    sudo mkdir -p "/media/backup/PBS/.chunks/$i"
done

2. Set the correct owner
Code:
 sudo chown backup:backup -R /media/backup/PBS/.chunks

After that, all backups completed without error.
Can't try a restore right now but don't see a reason for the restore to fail (his famous last words :) )
 
Last edited: