Scheduled VM-snapshots from GUI

Oct 4, 2019
37
7
28
40
Is there any way to fully automate the regular per-VM snapshot creation process found within the PVE GUI?
I want to do something similar to zfs-auto-snapshot, rolling daily snapshot creation for all volumes, where a week worth of snapshots are retained (to revert user/config mistakes), but I wan't the rollback process to be available from the GUI as if I had used the manual VM snapshot creation process from within the GUI.

Is this possible?
 
Last edited:
Hi,

no, this is not implemented.
 
I'd be interested in this feature too. I have large volumes, where classical backup don't fit.

What was the decision behind no, this is not implemented., since (in my eyes) this is not that hard to implement.?
 
Well, I have LVM, but does it matter?

If snapshot is not a backup, then what it is? What's the use case for it in one node "Datacenter" ?

snapshots are not a backup because they are on the same storage as the data itself. they serve a different purpose - you can use them as point-in-time reference to base replication on. or you can snapshot a guest before you do some experimental change, so that you can go back to the old, known-good state easily and quickly. for some use-cases a snapshot and a backup are both possible solutions (e.g., user delete important file -> grab it from yesterday's backup OR snapshot). the problems start when people attempt to use snapshots as replacement for proper backups, and then their disk dies and everything is gone. hence, snapshots are not backups ;)
 
for the original question: you can easily script around 'qm snapshot' or 'pct snapshot' or the API endpoints that they represent, so rolling your own simple 'auto-snapshot' solution with pruning is fairly straight-forward. be aware that their is a hard-limit for the file-size on /etc/pve, so I'd limit the snapshot count per guest.
 
@fabian: thanks for explanation. pve wiki does not elaborate on VM snapshots in much details.

One another issue I noticed with VM snapshots: they include only the first drive (sda), but not other drives. That may cause bad surprises...
 
Last edited:
@fabian: thanks for explanation. pve wiki does not elaborate on VM snapshots in much details.

One another issue I noticed with VM snapshots: they include only the first drive (sda), but not other drives. That may cause bad surprises...

huh? that's not true.. snapshots include all disks/mountpoints (and are only possible if all of them support it).
 
huh? that's not true.. snapshots include all disks/mountpoints (and are only possible if all of them support it).
I'm sorry, I overlooked it, you're absolutely right.

My assumption was based on the fact, that snapshot volumes are not shown under Datacenter > pve > pro-thin(pve) > Content:
1585819573414.png
Possibly snapshot volumes shall be shown here too, with type "Disk snapshot" or similar?
 
Last edited:
for the original question: you can easily script around 'qm snapshot' or 'pct snapshot' or the API endpoints that they represent, so rolling your own simple 'auto-snapshot' solution with pruning is fairly straight-forward. be aware that their is a hard-limit for the file-size on /etc/pve, so I'd limit the snapshot count per guest.

Would that be a simple bash-script with qm prune/delete, qm snapshot for the vm's I want to schedule "auto-snapshots"?
 
qm/pct snapshot/delsnapshot/listsnapshot (or the respective API calls)
 
This is not GUI-based, but does the trick for me. I started using "cv4pve-autosnap" for the automatic snapshots of VMs. Brilliant in it's simplicity.

I ran into that too. Will have a close look.
No need to reinvent the wheel if I don't need too. :)
 
There is a lot of stuff to consider. Anyone who hasn't done it before is going to oversimplify it, they can't help it. If you want to know more about it, you should come up with a solution that works for you. What works for you is unlikely to work for everyone and that's why it isn't implemented. Just speaking as someone who has implemented rolling snapshots on a number of platforms.

First, you have to be aware of how much free space is available on all the production storage and set a threshold beyong which it will abort. Your snapshot length needs to work within the amount of free space you have. You have to check to see if the VM is on or off, or if the guest agent is available to be able to handle the freeze and thaw processes, etc.

Second, you have to be aware of any passthrough hardware because that will cause problems during a machine snapshot. If you are passing in physical hardware, it technically is no longer a VM. You may want to pursue storage snapshots only or come up with a way of dismounting your passthrough hardware during the snapshot (not always possible).

Third, by having an automated process taking custody of snapshot chains, and understanding how dangerous "permanent" snapshots can be if people forget to eventually merge them and clean them up, you will eventually come up with a janitor process to keep the chain clean, whether a snapshot was orphaned or fell out of the rotation or was missed for some reason, snapshots exceeding a certain age should be deleted regardless of their purpose.

Your script may start out as "del snapshot .... create snapshot..." but it snowballs quickly.

Finally, some people may want to exclude certain disks from their rolling snapshot scheme. Unfortunately only VMware provides that kind of distinction with its persistent/dependent disk option. Hyper-V and qemu do not do that. I wish other platforms provided this.

corsinvest is great. look at their "BARC" solution for ceph backups. it was easily adapted for our needs.
 
Last edited:

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!