Suspend to disk on shutdown, resume on startup

Rhys79

New Member
Jun 9, 2020
4
4
3
46
New to Proxmox. I've figured out the qm commands to suspend to disk and resume a VM. I've figured out that the current commands to stop/start the VMs on shutdown/startup are in the pve-manager.service file. I've created a new service to which starts a hibernation of the VMs, and seems to work. However, something else goes down prior to the hibernation completing, and leaves the VM in a locked state after the reboot, forcing me to do a qm unlock and then delete the hibernation disk from the VM before attempting the process again.

Any suggestions on how to get the VMs to complete hibernation PRIOR to the rest of the system going down, and then automatically resume once the system comes back up? I'm soooooo close, but can't seem to figure out the last key bit to getting it to work.
 
Interesting. This would be in some cases a nice idea. I'm hanging on here.
 
Just to update, I've taken a slightly different route with this, since I couldn't seem to figure out how to get the hibernation to complete properly at shutdown. In my case, the specific usage scenario is to hibernate the VM only when the system is going down due to loss of power and the UPS battery being exhausted, in an effort to prevent database corruption due to sudden power loss. That being the case, I've made the hibernation part of the NUT shutdown script. This seems to work flawlessly, as I can run the hibernation command, wait for it to complete, then issue the shutdown command. In this way, the services required for the hibernation to complete properly don't get shutdown prior to the completion of the hibernation process.
 
  • Like
Reactions: ams_tschoening
Hey @Rhys79 did you finally got hibernation to work before shutting down proxmox host? could you guide us how you achieve?
I am trying to do the same but little bit lost on figuring out which scripts to create and when.

Thank you,