Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Hibernate a Debian/Ubuntu VPS?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Hibernate a Debian/Ubuntu VPS?

DavidRDavidR Member

Hey guys, I haven't had the need before, but now I do :-) I was searching quite a bit already and now thought I ask my favorite community for help. I basically need to get the VPS (Google Cloud VPS running Debian for instance) to go into hibernate aka write complete state on disk, so I can delete the machine (and keep the disk) and wake up in the same state once I attach the disk to a new machine with the exact same specs (incl. IP, which I see as only issue, if it changes)

There you go, haven't found a solution yet, hope somebody around here has an idea.

Thanks!!!

David

Comments

  • nerouxneroux Member

    Shutting down the machine and taking an image is not an option?

  • KVM can do this easily enough, using the syntax virsh pause <VM> or virsh suspend <VM> depending on where you got your packages and what versions they are.

    If you're using OpenVZ, then there is no state; and you don't need to worry (that's not real virtualization, etc.) Xen... no idea, but apparently it's similar.

  • wychwych Member

    Interesting idea...

  • To add to the above, in OpenNebula; I can use the syntax as follows:

    onevm snapshot 123 --live --force to make an immediate snapshot of the entire disk and memory, and store that persistently somewhere for transfer to another machine. It also supports differential updates, [ for the HA stuff for example. ]

  • DavidRDavidR Member
    edited May 2014

    --- Shutting down the machine and taking an image is not an option? ---

    It is, but it's rather "half-hearted" and also means (a) existing RAM-disks are empty again and (b) all running programs are not running anymore - which is the whole point :)

  • DavidRDavidR Member

    @GoodHosting: Seems all you suggest is not working from within the VPS (aka as a client, not the hoster), or did I get that wrong?

  • nerouxneroux Member

    @DavidR said:
    all running programs are not running anymore - which is the whole point :)

    Then of course it is not an option but may I ask why?

  • DavidRDavidR Member

    lol, your question made me smile - you may not believe it, but there is software that actually likes to be in the same state more than being restarted :)

    Anyway, there is always the "solution" of running a virtual box inside of the VPS and save the state of it, but that's just overhead I would love to get around somehow if it would work without.

    Seems so far nobody has a better idea, maybe too late at night for most of you (not me, Australia here ;) )

  • nerouxneroux Member

    DavidR said: lol, your question made me smile - you may not believe it, but there is software that actually likes to be in the same state more than being restarted :)

    Such as? ;)

  • DavidRDavidR Member

    It's custom software that takes about 1h to start up doing extensive IOs over that period of time. Design flaw one could argue, and I did, but you gotta take what you got sometimes.. And at the end, if it runs smoothly once the whole starting calculation procedure is over, hibernate or something similar is an option that seriously needs to be considered, unless you want to wait for 1h every time you start up or want to pay for the cloud server 720h/month, even if it is not needed, just to be "ready" when you need to be.. (me == not)

    And no, SSD doesn't help (1h is from SSD already, could take several hours from "normal HDD") and yes, can work out of a RAM DRIVE, but RAM is expensive + then the RAM is not available for normal operation, so no feasible option either. (and a nightmare doing the aftermath of an unexpected reboot etc....)

  • nerouxneroux Member

    DavidR said: Design flaw one could argue, and I did, but you gotta take what you got sometimes

    I agree. Generally speaking something which should be fixed of course but if the circumstances are like this a workaround like the one you are looking for is certainly of help.

  • DavidRDavidR Member

    Now we just need somebody to find this thread and have a solution to offer, fingers crossed.

    Otherwise I guess I have to go for a virtual within the virtual, don't like that thought, but hey.. Any suggestions as to what software to use that takes least resources and does live snapshots? Never had to do this in a VPS environment before.

    If all goes wrong, dedicated server it is, but really, there must be something out there, isn't it?

  • nerouxneroux Member

    Did you contact Google's support about this?

  • DavidRDavidR Member

    Google support? LOL Good one....... (if you'd tried that, you'd "get it" ;) ) Well I guess if you pay for "super premium support" they might even answer

  • DavidRDavidR Member

    pm-hibernate is not working in a VPS environment afaik (tested it) :( (or am I doing something wrong? did anybody get it to work?)

  • wiffelwiffel Member

    Depending on the application(s) you use, you could give dmtcp a try. It enables checkpointing and restarting applications in linux userspace.

    It's a bit researchy and mainly built to be used on bigger - multi node - computing clusters with long running applications. But also works on single node systems.

    It did work on most of the applications I tried it on, but also crashed on a few of them. So, your mileage may vary. But it's kind of cool if it works on your application. It did enable me - e.g. - to migrate running applications to other nodes.

  • DavidR said: Otherwise I guess I have to go for a virtual within the virtual, don't like that thought, but hey.. Any suggestions as to what software to use that takes least resources and does live snapshots? Never had to do this in a VPS environment before.

    You probably won't be able to run true virtualization inside a VPS, but you could try LXC (aka Linux Containers) which work similarly to OpenVZ. There is a lxc-freeze(1) which might do the trick.

  • DavidRDavidR Member

    Thanks deptadapt, if nobody comes up with an idea how to hibernate I guess that's what I try then, geeez... Some things are easier in Windows, it's sad....

  • Heh don't thank me yet, I'm still learning LXC. And as far as I can tell lxc-freeze stops all the processes in a container but leaves them in memory. I don't think that's going to solve your problem.

    The application you're using that takes forever to start up, is it able to cache the results of whatever it's doing at start up?

    I tested pm-hibernate in a KVM vm here at home and it worked. How much swap do you have? Your swap partition needs to be at least larger than the amount of ram you have. I recommend twice the size of ram.

  • DavidRDavidR Member

    Well I thank you for trying then :) Haven't tried in a KVM, but in google cloud machines pm-hibernate seems to do nothing, unfortunately. (a "normal" VPS doesn't need to be "off" to save fees, it's really mainly a cloud-machine issue - every day a cloud machine is off can save serious money for the bigger ones)

  • @DavidR said:
    Well I thank you for trying then :) Haven't tried in a KVM, but in google cloud machines pm-hibernate seems to do nothing, unfortunately. (a "normal" VPS doesn't need to be "off" to save fees, it's really mainly a cloud-machine issue - every day a cloud machine is off can save serious money for the bigger ones)

    Have you considered doing something rather anarcbous in Python with "memoryview" to save the memory space and execution state of the process, then manually stall it (deny it of a single CPU cycle to keep the state while saving.); thus you can get a proper save, and restore from that.

  • @DavidR said:

    It could be wrong, but Wikipedia says that Google Cloud uses KVM. Maybe Google has disabled the ability to hibernate somehow but I would keep looking you can probably figure it out.

    Did you check the logs after running pm-hibernate?

Sign In or Register to comment.