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?
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?