qmrestore hook script ??


Well-Known Member
Oct 8, 2019

Having a hook script on vzdump is great as it offers heaps of flexibility for post-processing the backup without modifying the code. Is there a way to have a hook script on qmrestore so we can pre-process prior to performing the restore? And a hook that's called when a backup is deleted?


No there is no qmrestore hook.
What would be the benefit?
qmrestore will not run in a job where this would make sense.
"backup-end" is short before deleting the image.
Hi Wolfgang

The use case I was thinking of was still around dedup of the backups. With a post-backup hook we can unpack the VMA into raw images that dedup very well. If we could then have a pre-restore hook, we could rebuild the VMA so the proxmox processes just see a VMA being written out and a VMA being read back in.

That's the use case I was thinking of, but given the flexibility others may have their own too. If we can post-process a backup having the ability to pre-process the restore would be very handy.

This sounds very complicated.

I don't know what storage you are using or if you need a generic approach.
But if you have storage which supports snapshots.
Then a better way is to use the snapshot feature and read only mount the snapshot.
Then you can do your magic on the mount point.
But then how does a customer restore their own backup through the UI (or whmcs module etc)? Unless I've missed something (and I'm new here that's quite possible) your restore process wouldn't know about our "magic" so it couldn't restore from it. I thought a script to unpack and then a script to repack was pretty simple, particularly if we use hooks provided by you guys so we don't patch any code.

BTW, we'd probably look at backing this onto ZFS over NFS. Our testing with dd's of images off our current platform looked very promising.


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!