zfs snapshot hooking

Mael Strom

Member
Sep 21, 2019
11
1
23
Hi, lads and ladies.
I stuck with one little trouble about topic.

I have a lot of VMs and CTs in a Proxmox environment, zfs-based. Some of them contains db or other services, that *CAN* restore after unclean shutdown, but it would be better to have them *CLEAN* at snapshot taken.

I'm using HA/replication within 3-nodes cluster. It calls `zfs snapshot` to take a snapshot.
Same for a backup.
Sometimes I call `pct snapshot` or `qm snapshot` to make an intermediate snapshot for some purposes.

Now, all the way I need to send some commands into CT/VM to make snapshot as cleaner as it can.

I'm able wrap backup command with some systemd timer and make bash alias for `pct snap`/`qm snap`, but it's not the same.
It's hidden, blackboxed solution, non-manageable by Proxmox itself in any available ways.
And there is nothing to do with replication.

It will be nice to have `pre-snap script` and `post-snap script` or add these subcommands in CT/VM `script` feature.
 
It is also possible to include a RAM dump to that snapshot so you can rollback into the running system. So there is no unclean shutdown if you rollback because it wasn't shutdown at all. You can set the "state storage" for each VM where the RAM dumps will be stored as zvols.
 
Last edited:

Dunuin,​

yes, but snapshot with memory is VMs only, it isn't available for nor CTs, nor HA/replication. It's not available to mass backups in interface.
So, it's just
very particular solution.

 
See
https://bugzilla.proxmox.com/show_bug.cgi?id=2530

for a (related) enhancement request - maybe you'd like to add the pre/post snapshotting hook entry points there as well (and thus get notified if there's some progress with that)

I hope this helps!
 
  • Like
Reactions: Mael Strom
Well, it will require some perl knowledge and diving into pve code, but looks like good point to start.
 

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!