How snapshot-hibernate from grub??

If it doesn't relate to Debian, but you still want to share it, please do it here

How snapshot-hibernate from grub??

Postby bester69 » 2017-09-27 15:11

I know i can hibernate the system and then when i poweron back the computer recover the whole system state.

I was wondering if its possible to keep some hibernate state, so i can recover it when I wish. This is what i'd like to do:
- I open some apps, with much tasks running in ram, and I save the state for restoing eventually.
- I restart session to clean state and use that session for others things,
- Some days later i decide to take back my saved state work by restoring that hibernate state.

Is there any way/tools to achieve this thing?
Last edited by bester69 on 2017-09-27 18:58, edited 1 time in total.
User avatar
bester69
 
Posts: 948
Joined: 2015-04-02 13:15

Re: Is it possible to save/restore a system State?

Postby Bulkley » 2017-09-27 17:35

I can't give you the answer you want but I can give you a good place to look. Prefbar has lots of buttons that do all sorts of stuff I didn't know could be done.
Bulkley
 
Posts: 5320
Joined: 2006-02-11 18:35

Re: Is it possible to save/restore a system State?

Postby alan stone » 2017-09-27 18:32

How about a session manager? See here and here. EDIT: And here.
Debian 8.9 32bit, WM: Openbox
Computers are like air conditioners. They work fine until you start opening windows. - Author Unknown
Programming is like sex. One mistake and you have to support it for the rest of your life. - Michael Sinz
User avatar
alan stone
 
Posts: 205
Joined: 2011-10-22 14:08
Location: In my body.

Re: Is it possible to save/restore a system State?

Postby bester69 » 2017-09-27 18:56

alan stone wrote:How about a session manager? See here and here. EDIT: And here.

No its not that, what im lookin for,

I found this: Hibernate and resume from a swap file
https://askubuntu.com/questions/6769/hi ... -swap-file

I'd like an easy way to get this, a way to load a snapshot-hibernate from grub manager..
User avatar
bester69
 
Posts: 948
Joined: 2015-04-02 13:15

Re: Is it possible to save/restore a system State?

Postby pylkko » 2017-09-27 19:03

Perhaps consider having two physical machines for each session. Or two virtual machines. Run seperate installs on a hypervisor? Use a live image in between a hibernation from the real session? Dual boot a major session and a smaller session from EFI or bootloader and have separate swaps for them?

Normally hibernation writes an image to the swap partition or a swap file if you configure that. Then it leaves a hook for the kernel to reboot from the location which in Debian, I think, is give in grub's config. You can also hibernate, reboot and pass noresume to the kernel as a boot parameter in which case it will skip resume from disk. Because it is possible to hibernate without swap partition (https://wiki.debian.org/Hibernation/Hib ... _Partition) and because you can make an image of a swap partition, you might be able to do the following some how: write system state to file, clone that file, hibernate, pass no resume, run small session, quit, move large session file back, reboot with resume.

EDIT: I see that while I was typing you posted a link that describe almost exactly what I suggested.
User avatar
pylkko
 
Posts: 1174
Joined: 2014-11-06 19:02

Re: Is it possible to save/restore a system State?

Postby bester69 » 2017-09-27 19:18

pylkko wrote:.....and because you can make an image of a swap partition, you might be able to do the following some how:

write system state to file, clone that file, hibernate, pass no resume, run small session, quit, move large session file back, reboot with resume.
.....describe almost exactly what I suggested.


Yes!!, this pylkko!!

I dont know if this is easy to do, I can play with btrfs snapshots what will make it easier, i also dont know if this works properly or can give you troubles. :o
User avatar
bester69
 
Posts: 948
Joined: 2015-04-02 13:15

Re: Is it possible to save/restore a system State?

Postby pylkko » 2017-09-30 07:24

Well, I don't know what would happen if the system on disk changes during another session. For example, let's say you open a file for editing in session 1, leaving it open in the hibernation image, and then delete that same file in session 2 from the disk and then go back to session 1. There would be an open file reference in memory to a non-existant file.Now, what if the operating system does these kinds of operations in the background? what if you don't just delete one file, but upgrade your operating system chaging many files? I have no idea. I don't know if anyone has ever even tried this, a quick internet search did not reveal any attempts.
User avatar
pylkko
 
Posts: 1174
Joined: 2014-11-06 19:02

Re: Is it possible to save/restore a system State?

Postby bester69 » 2017-09-30 15:17

pylkko wrote:Well, I don't know what would happen if the system on disk changes during another session. For example, let's say you open a file for editing in session 1, leaving it open in the hibernation image, and then delete that same file in session 2 from the disk and then go back to session 1. There would be an open file reference in memory to a non-existant file.Now, what if the operating system does these kinds of operations in the background? what if you don't just delete one file, but upgrade your operating system chaging many files? I have no idea. I don't know if anyone has ever even tried this, a quick internet search did not reveal any attempts.

What we're doing here, its to make a snapshot of the hibernated system . I think this must be very possible cos it has much sense,

Look, with BTRFS, we can make the filesytem snapshot with a livecd session, once the system was hibernated. In the same live session we would backup the swap-file used with "uswsusp" (We would have keep and clone that swap-file in another partition to be able to play with it).

Once we want to restore hibernated session, we would remount BTRS snapshot and we would replace the dirty swap-file with the previously cloned. I'd like you to try it if you feel like it. Then we reboot, and everithing should restore from the hibernate state. I will do it when i have a time, Im just curious if my way can works, furthermore it can be very usefull to know how to keep a session in disc. :o
User avatar
bester69
 
Posts: 948
Joined: 2015-04-02 13:15

Re: How snapshot-hibernate from grub??

Postby pylkko » 2017-10-01 05:31

Regrettably I have to inform you that I don't personally need what you desire and I have too little spare time
User avatar
pylkko
 
Posts: 1174
Joined: 2014-11-06 19:02

Re: Is it possible to save/restore a system State?

Postby alan stone » 2017-10-01 08:02

bester69 wrote: I'd like you to try it if you feel like it. ... I will do it when i have a time, Im just curious if my way can works,

So what you were looking for and curious about is not exactly what you were looking for and curious about?
Debian 8.9 32bit, WM: Openbox
Computers are like air conditioners. They work fine until you start opening windows. - Author Unknown
Programming is like sex. One mistake and you have to support it for the rest of your life. - Michael Sinz
User avatar
alan stone
 
Posts: 205
Joined: 2011-10-22 14:08
Location: In my body.


Return to Offtopic

Who is online

Users browsing this forum: Pick2 and 4 guests

fashionable