Hibernate without poweroff on Linux

0

Is there a way, on Linux, to hibernate without performing a shutdown and even continuing working?

My idea is to hibernate at defined intervals in such a way to prevent data loss (and restarting programs, reopening files, etc...) in case of power outage.

Moebius

Posted 2014-06-14T10:21:18.080

Reputation: 428

1Unless you are running Linux on top of a virtual machine (where you could take regular shapshots), I don't think so. – Doktoro Reichard – 2014-06-14T10:51:09.627

well even if he uses a VM snapshot, it will not work, as it will revert the data to what it was during a snapshot. And OP wants to prevent that. In short: what you want is not going to work. Fix whatever is causing your server / programs to crash. – phoops – 2014-06-14T10:53:31.763

Answers

1

What you are suggesting is never going to work. Among all the things, hibernation saves what is currently in memory and executes shutdown. It only works because shutdown makes sure that system does not change state (no changes to disk, files etc.). Even if hybernate would support it, you would not be able to use it as a "snapshot" as otherwise you would always have to reset EVERYTHING (including your data to the point when snapshot was made). Considering you want this to prevent such thing (data loss), this will not work.

If you have problems with your program / server crashing, fix them. Don't try to reinvent workaround patches.

phoops

Posted 2014-06-14T10:21:18.080

Reputation: 2 977

0

My idea is to hibernate at defined intervals in such a way to prevent data loss (and restarting programs, reopening files, etc...) in case of power outage. [my boldface]

You shouldn't use hibernation for that; edvinas.me has already explained why. Instead, what you need is a UPS (Uninterruptible Power Supply).

A UPS is basically a big battery plus some electronics to take the battery voltage and provide mains-like voltage from it. Depending on how much power your computer draws and what your budget is, you can get versions that range in run time from a few minutes at most to many hours. If you want longer run times than a few tens of minutes, however, the most reasonable choice is probably to get a smaller battery-based UPS and combine it with some sort of generator for extended outages; the battery will provide power during brief outages and while the generator is starting up and stabilizing, while the generator provides longer-term power backup. The latter setup (with large battery-backed UPSes and generators) is pretty common in datacenters.

Don't underestimate the value of a UPS that provides even only a few minutes worth of run time on batteries; even that will get you through power "glitches" (outages that last no more than a few seconds) with plenty enough time remaining to give the computer enough time to hibernate and turn off before the battery is depleted if it turns out to be a longer outage. When the power comes back, you can just continue working wherever you were when you lost power.

UPSes also often provide mains voltage filtering, which will help the longevity of your equipment as it won't be subjected to voltage variations that may otherwise be found on the mains, particularly if you are at the end of a long feed. Properly installed, such should also function as lighting arrestors; at least one UPS vendor has a very generous warranty for equipment hooked up behind the UPS getting damaged due to AC mains problems.

a CVn

Posted 2014-06-14T10:21:18.080

Reputation: 26 553