options for automating backups

Faris Raouf

Well-Known Member
Mar 19, 2018
I want to automate my VM backups but I'm not sure of the best way to achieve what I want.

I want to backup each VM weekly, keeping a total of 4 backups EXCEPT for one particular VM, which has a huge disk volume, and I only want to keep one backup for this one.

Adding to the complication, I want to be able to manually make any number of additional backups at any time.

I store backups in /backuplocation which is currently set with unlimited backups in the GUI.

I can see two options:

1) Create a Directory /backuplocation/limit4 and set it to have a maximum of 4 backups, Create a Directory /backuplocation/limit1 and set it to have a maximum of 1 backup, and then use the built-in automated backup tasks to separately backup all but the big one, and then the big one, to the appropriate Directory. I would then be able to make any additional manual backups to /backuplocation as required.

2) Manually create a script that uses vzdump with --remove 1 and --maxfiles 1 or 4 depending on the VM and just run it via cron every week.

I think option 2 is most sensible as there is no need to create yet more directories or worry about specifying which directory to backup to, but any additional manual backups I may have made after the last automated backup will cause issues at the time of the next automated backup, because all but the last four (or 1) backups will end up deleted. So instead of backups going back 4 weeks, I could potentially in a worst case scenario end up with only backups from a few days ago. [Since I would be copying all backups to S3 after the automated task has completed, this isn't a terrible thing - but it is annoying]

So, is there another way? Maybe someone can suggest a better way? Or maybe I should go with Option 1 after all?
you could either define two storages for your automatic and manual backups and define different maxfiles, or setup a hook script that does the house-keeping for the automatic backups instead of the rather simple "remove oldest" that is builtin. pve-manager ships an example hook script that shows all the different points in the backup process where it gets called.


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!