How to hibernate Linux To Go to disk and restore it on a different device?

I have my Linux installed on a portable SSD, so I can switch devices (laptop at home, desktop in office) easily and don’t need to consider any syncronization problems. This is called Linux To Go.

It’s quite nice already, but could it be even better?

To switch devices during a work flow, I must exit all applications (gracefully), shutdown the OS completely, then detach and attach the SSD, boot the OS, wait for its powering-up, and last, reopen all the applications needed to resume my work.

Now I want to find a way to achieve "pause and resume" instead of such "stop and restart". I want the OS memory to persist across different devices.

It seems like hibernation is a potential solution. Maybe I could save the memory in a swap partition by hibernating the OS, then detach and attach the SSD, boot the OS, and shortly, the memory is restored so I can continue my work flow.

But after some googling, I can’t find any tutorial/blogs about hibernation across multiple devices.

How to hibernate Linux To Go to disk and restore it on a different device? Or, is it simply impossible?

Asked By: Lingfeng Fu

||

I don’t think hibernation across different devices can possibly work unless the devices are exactly the same in terms of HW configuration (CPU, GPU, RAM, storage, peripherals) and even in this case it’s far from certain.

There used to be a project called CryoPID which allowed to save the image of a running application and later resume it however it’s long been dead and unmaintained and doesn’t work with new Linux kernels. Please check this topic for more possible up to date solutions: https://stackoverflow.com/questions/2134771/how-to-hibernate-a-process-in-linux-by-storing-its-memory-to-disk-and-restorin

To be honest I don’t see any modern working solutions in the mentioned topic except using VirtualBox/virtualization to preserve the state of your running applications. That’s not quite pleasant to deal with but it works perfectly.

Here’s an even better idea: if you have a fast Internet connection you could probably consider having an always on remote PC where you have your workflow and access it using whatever means possible, e.g. RDP/VNC/SSH -x/etc.

Answered By: Artem S. Tashkinov
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.