Datastore prune/retention policy goes wrong

Jul 26, 2021
57
13
13
55
Hi,

I'm currently experiencing some trouble on both backup servers (1.1-13 and 2.1-4) with the retentention policies on some of the PVE backups (not all). There are no settings on the PVE hosts so retention is controlled by the backup servers. There are policies set on the datastores for keeping 2 last backups, 1 for the week and 1 for the month. So there should be always 4 backups keeped, but currently there will be only the last backup keeped. I had a look into the task log and noticed that on the affected datastore allways run a prune job with option "keep last =1" right after the backup job. I didn't scheduled this prune job so I 'm surprised why it will be started. Is it started by the PBS host or by the PVE client? Does anybody have an idea how to prevent this additional prune job?

Thanks & Best Regards
Martin
 
Hi,
if it happens right after the backup, it is very likely triggered by the Proxmox VE side. You can check the log of the backup task in Proxmox VE to verify this. Please check the retention settings (prune-backups and the deprecated maxfiles) for the PBS storage configured there, the vzdump defaults on each node /etc/vzdump.conf and the retention settings for the backup job itself.
 
Hi Fabian,

many thanks for your support. So I know that I have to focus on the PVE hosts to find the reason for this behavior, and it seems I already found it. For the other users, I will try to explain what I think what exactly happened, maybe it helps someone who is experiencing similar issues.

We are using install scripts for the initial setup of our PVE hosts. Part of these scripts is also to create two backup storages for our PBS hosts. I had a look at these install scripts and found this line of code that manage the creation of the backups storages:

pvesm add pbs backup --server x.x.x.x --datastore $HOSTNAME --username root@pam --fingerprint AA:BB:CC --password 'password'

I noticed that there are no prune options given, so there will be used default settings during the creation process. These default settings should be the reason, because they seem to use "keep last=1" rule. I plan to modify the code to the following line:

pvesm add pbs backup --server x.x.x.x --datastore $HOSTNAME --username root@pam --fingerprint AA:BB:CC --password 'password' -prune-backups keep-all=1

In my understanding, this option should prevent the prune job after the backup, or it will run but does not modify anything.

On the existing PVE hosts that are affected by the issue, I plan to execute the following command to modify the prune options:

pvesm set backup --prune-backups keep-all=1

Please let my know if there is anything wrong on my thoughts.

Best Regards,
Martin
 
Hi Fabian,

many thanks for your support. So I know that I have to focus on the PVE hosts to find the reason for this behavior, and it seems I already found it. For the other users, I will try to explain what I think what exactly happened, maybe it helps someone who is experiencing similar issues.

We are using install scripts for the initial setup of our PVE hosts. Part of these scripts is also to create two backup storages for our PBS hosts. I had a look at these install scripts and found this line of code that manage the creation of the backups storages:

pvesm add pbs backup --server x.x.x.x --datastore $HOSTNAME --username root@pam --fingerprint AA:BB:CC --password 'password'

I noticed that there are no prune options given, so there will be used default settings during the creation process. These default settings should be the reason, because they seem to use "keep last=1" rule. I plan to modify the code to the following line:
Yes, this was the vzdump default for many years (with the maxfiles setting), so we only could switch during the major release. In Proxmox VE 7.x, the default should be keep-all=1, see here.

pvesm add pbs backup --server x.x.x.x --datastore $HOSTNAME --username root@pam --fingerprint AA:BB:CC --password 'password' -prune-backups keep-all=1

In my understanding, this option should prevent the prune job after the backup, or it will run but does not modify anything.

On the existing PVE hosts that are affected by the issue, I plan to execute the following command to modify the prune options:

pvesm set backup --prune-backups keep-all=1

Please let my know if there is anything wrong on my thoughts.
Sounds good to me.
Best Regards,
Martin
 
Hi Fabian,

I can confirm that this issue is fixed. I tried this settings on one of the affected hosts and it works well. The midday backup just finished and now the content count shows 2 versions.

Best Regards
Martin
 

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!