zfs snapshot hooking

Mael Strom

Member
Sep 21, 2019
8
1
8
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.
 

Dunuin

Famous Member
Jun 30, 2020
6,811
1,585
149
Germany
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:

Mael Strom

Member
Sep 21, 2019
8
1
8

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.

 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,995
1,086
164
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

Mael Strom

Member
Sep 21, 2019
8
1
8
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 your own in 60 seconds.

Buy now!