Backups deleted prematurely

HuskyGuy

New Member
Dec 19, 2024
5
1
3
I have had 2 backup schedules running for several months. The "weekly" ran on Sunday with a retention of 4 and the "daily" ran Mon-Sat with a retention of 6 (set in the backup job - not the Storage). I think it was about 3 weeks ago I noticed that while the daily retention for each individual VM/CT was rolling over as expected but the weekly job was now pruning everything but the most recent backup. I just verified that this morning.

Today I did some googling and see that instead of letting the backup job specify the retention I could apply a retention on the Storage itself in Datacenter > Storage > ID > Edit > Backup Retention. I created a backup job of a single LXC and initially set Keep Last to 1, Keep daily to 5, and Keep Monthly to 4 but after running the job manually twice it deleted the first backup. I changed Keep Last to 10 (one more than daily+monthly) and have it running every 30 minutes to test.

If I want to save 6 daily backups and 4 monthly backups of each VM/CT, is this the right way to globally apply a retention? How does the backup scheduler know when to mark a backup as a Monthly and retain 4 versions, vs. a daily for 6, especially if there is only one job? Other than my "comment" in the job itself what differentiates a daily from weekly or monthly job for retention purposes? Thanks!
 
I don't think I would be able to answer these questions better than the original documentation, so I'm just giving the link
:): https://pbs.proxmox.com/docs/maintenance.html#pruning

In case you can't discover the proper retension scheme after reading these docs (I admit it wasn't quite obvious for me ;-)) you can trial-and-error method with the Prune Simulator at https://pbs.proxmox.com/docs/prune-simulator/index.html

edit: To avoid interfering by the PVE jobs I recommend setting the retension only in the PBS. An additional benefit is more secure backup because an accidental (or after compromising PVE) deleting backups provoked by PVE is avoided.

I don't know your setup, so the following remark may be redundant. While adding a PBS datastore in the PVE, don't use PBS' root account. Instead create a new user in the PBS and give it limited roles. Accidentally just yesterday I posted a similar advice, so to not repeat myself I'll just point to it: https://forum.proxmox.com/threads/p...n-vm-on-pve-or-not-at-all.177367/#post-822567
 
Last edited:
  • Like
Reactions: UdoB