Safe Hibernation

Alemiz

New Member
Jun 9, 2019
19
4
3
30
Hi,
Im writing simple script what to do after power will be lost and server will run on UPS.
My plan is:
- hibernate all VM
- hibernate node
Or just hibernate node ?
Is it safe ? Wont I loss any data ?

Thanks!
 
Hi,
it depends - where is your data stored?
We have similar problems:
We have a 15node cluster using ceph, so it is important to stop all VMs on all hosts, before the storage can be stopped.
Proxmox will shut down all VMs on a single host and then shuts down this host.
So it is possible that some hosts without VMs but with CEPH-OSDs are going down early and hosts with many or slow VMs cant reach their data anymore, which is bad....
 
Hi,
it depends - where is your data stored?
We have similar problems:
We have a 15node cluster using ceph, so it is important to stop all VMs on all hosts, before the storage can be stopped.
Proxmox will shut down all VMs on a single host and then shuts down this host.
So it is possible that some hosts without VMs but with CEPH-OSDs are going down early and hosts with many or slow VMs cant reach their data anymore, which is bad....
HI, I have currently no cluster. And data are stored on nodes RAID 1. What do you recommend me ?
 
I managed to get host hibernation and resume working....

1) Make sure your swap partition will fit all your host's RAM (i.e. 24GB RAM /dev/pve/swap >= 24GB)
This can be increased by shrinking / (/dev/pve/root) by an appropriate amount and increasing /dev/pve/swap

https://soban.pl/extending-swap-space-on-proxmox-using-lvreduce/

Explains howto... But remember, you can't do this on a live system, so need to use something like a LIVE disc to be able to
edit it, when NOT in use.

2) All VMs must be hibernated or stopped (a script can do this for you). This is for when you're ready to do the hibernate.
If they're not hibernated, it seems to fails to suspend to disc (sometimes...)

3) Install pm-utils

> apt install pm-utils

These utilities allows you to use pm-hibernate, this is what I use to initiate hibernation of host from CMDLINE..

4) If you want to use WOL, Make sure you have WOL enabled in you BIOS AND in your proxmox host.

Proxmox GUI, host -> Options Enable WOL <set MAC address to PHYSICAL mac address of the REAL machine>

If you have multiple adapters, use you're going to use to wake from.

5) You can now test hibernating the machine, but it won't wake up where you left off until in can resume succesfully...

6) Add SWAP file UUID to grub entry, to allow resume.

First you need to get the UUID of the hosts swap partition from the LVM.

> blkid /dev/pve/swap

Returns something like;

/dev/pve/swap: UUID="65041724-95d6-42ab-8fe3-cbd3d3581cd0" TYPE="swap"

The value in quotes is your swap partition's UUID. Copy it (without the quotes) to paste into the /etc/default/grub file.
Use your favourite editor to edit /etc/default/grub.

> vile /etc/default/grub

Find the line, something like;

GRUB_CMDLINE_LINUX_DEFAULT="quiet"

You need to change it to ;

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=<your-UUID-from-previous-step-(without-quotes)>"
# GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=65041724-95d6-42ab-8fe3-cbd3d3581cd0" # Like this, but YOUR UUID ! ! !
# GRUB_CMDLINE_LINUX_DEFAULT="quiet"

Save the file. Then remember to update the GRUB installation on boot using CMD update-grub

> update-grub

Now you should be ready.

7) Test it works...

> pm-hibernate; echo It worked !

Should give you the echo when it resumes. You can fake the WOL by pressing the ON button on your host.

I use Wake-On-Lan from Aquila Technology under windows, or the WOL function in my router (from outside) or WOL application found
in Linux repository.


Enjoy ;)
 
  • Like
Reactions: waltar