Backup specific VM disk on specific schedule

dpi

New Member
Mar 29, 2024
3
0
1
Hi,
as i've stated in the subject, i was wondering after searching around the forum if any functionality that allows to backup single disks was implemented.

As an example:
VMID 100, 2 disks of 100GB each, disk 100-1, and disk 100-2

i wish to backup disk 100-1 every monday, disk 100-2 every night.

Would that be possibile? whether in an official manner or with workarounds.

Thanks in advance

Best regards :)
 
workarounds
AFAIK there is no in-built method for what you want. But I can think of a (problematic) workaround:

1. Create 2 new VM's; VM101 & VM102.
2. Edit their <VMID>.conf files, adding disk 100-1 to one of them & disk 100-2 to the second VM.
3. Create a backup job for VM1 with its schedule & a second backup job for VM2 & its own schedule.
4. You should however stop/suspend the VM100 before the backups start. (Cron job / hook script?).
5. You probably also want to make sure that VM1 & VM2 are NEVER run - as you risk corrupting those disks.

I've never tried any of the above (mess!), but you'd probably be better off creating your own scripts for each backup (rsync etc.) & having a cron job for each. Again you should suspend/stop the VM100 within these scripts & then restart the VM100 at the end.


While typing all of this I realized there may be an easier workaround:

1. In the config of VM100 set backup=0 for disk 100-1 and backup=1 for disk 100-2.
2. Have a cron job set for each Monday (before the backup time) that edits the config file on disk 100-1 to backup=1.
3. Have a cron job set for each Tuesday (after the backup above) that edits the config file on disk 100-1 to backup=0.
4. Make sure the retention policy tallies with your requirements.
 
While i will still be waiting (hopefully!) for an integration in the webui, your second solution doesn't look that bad.
If necessary, i will definitely implement that one.

Thanks!

Leaving the thread open hoping someone from the staff can enlighten us about the status of this feature, or if its even considered :p
 
Haha, the workaround is actually clever!!

vzdump (the command) doesn't have such a feature, probably because all the logic for that is hold in Qemu Server. The way it seems to be set is getting the list of volumes, and decide based on their properties or specific setting (backup=0/1), add them in the mix.

PVE/VZDump/QemuServer.pm, line 90:
Code:
my $backup_volumes = PVE::QemuConfig->get_backup_volumes($conf);

So, behavior is listed in get_backup_volumes in QemuConfig.

Maybe make that backup setting a bit more precise than 0/1, or have a backup_schedule thing added there. My guess is that Proxmox devs don't want to add any more information in the backup process there to keep it very generic. But you probably can add something in the config, leading to a new condition to be included so as to decide which disk to "enable" there.
 

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!