Home:ALL Converter>Configure Linux to Suspend to Disk on ACPI G2 Soft Off -- so Google Compute Engine can suspend and restore preemptible machine via disk

Configure Linux to Suspend to Disk on ACPI G2 Soft Off -- so Google Compute Engine can suspend and restore preemptible machine via disk

Ask Time:2017-02-01T15:55:51         Author:xmedeko

Json Formatter

Google Compute Engine rents all size Linux VMs from 1 core to 64 cores at various prices. There are "preempt-able" instances for about 1/4 the price of guaranteed instances, but the the preempt-able instances can be terminated at any time (with an ACPI G2 soft off warning and ~ 30 secs until hard cutoff). Although you can provide a startup and shutdown script, the usual approach seems to lead to the unnecessary overhead of having to then create additional software to allow calculations to be interrupted, and to manage partial results of calculations whereas the suspend-to-disk/restore-from-disk scheme seen in laptops and desktops could be a much simpler approach to storing and resuming calculations and therefore preferable.

If I start a Linux preemptible VM on GCE, is it possible generally to suspend the state of the VM to the disk (aka hibernate) and restart a new preemptible VM from the disk afterwards? My idea is:

  1. Start a new preemptible Linux VM.
  2. When the OS receives the the preemption notice (ACPI G2 Soft Off signal), then trigger suspend the to disk - hibernate the Linux OS.
  3. Start a new preemptible Linux VM from the suspended image, i.e. restore the former VM and continue in the computation.

How would I configure Linux to suspend/restore in this way?

Author:xmedeko,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41974562/configure-linux-to-suspend-to-disk-on-acpi-g2-soft-off-so-google-compute-engi
yy