3

I don't quite get to which extent Azure IaaS virtual machines (not VM roles) can persist state. Clearly files on local disks are preserved.

Is memory state also preserved? Can I "suspend" a VM like in VMWare and then resume it with all programs running?

sharptooth
  • 167,383
  • 100
  • 513
  • 979
  • 1
    I wonder if you could do this by enabling Hibernation in the OS and then hibernating it. This writes the memory out to the disk and then on restart loads it back up, just like a laptop. I do not believe this is exposed from the portal though. Make sure to not leave the VM out there in a hibernated state as it would cost you. Instead you should then delete the deployment of the instance. Then when you want to bring it back up you can script a VM start using that underlying OS disk that had been hibernated. I've not tested hibernation, but just thought it might help. – MikeWo Oct 10 '12 at 13:19
  • No, hibernation is not supported for VMs. – proteus May 22 '13 at 05:43

3 Answers3

3

There is no suspension option. You can start/shutdown the machines, and capture (image) them.

Capturing makes a copy of the disks only, and not the memory. Windows servers should be sysprepped beforehand. The machine must be powered off to capture.

enter image description here

Richard Astbury
  • 2,323
  • 18
  • 28
1

The closest thing would be to snapshot the VM, however that only snapshots the disks, not anything in memory.

This Snapshot overview provides a bit more information; just remember that snapshots are being taken at the blob (vhd) level, not the VM level.

AndyHerb
  • 670
  • 9
  • 27
1

As Azure VM have only 2 states i.e. start and stop but you can certainly tweak this by using extension mechanism while VM creation. We can do this hibernation as below steps.

1. Create an standalone application, which will do following things. a. Read your system "Recent File". b. Scan all the running process. c. Now based on process name and recently opened file from recent directory get their absolute path and store into some temp file.

b. Make sure that file creation should overwrite old file, every time it execute. e. If file exist then during startup this application should opened all the listed file and launch process too.

2. Now, Store your above created executable file into some publicly access Storage account.

3. Write one power shell scripts where you can access above mentioned storage account and it will download step 1 created executable application into that VM, which will keep scanning and reading and storing all the recently opened applications into one temp file and during startup it should open too.

4. For getting download that executable into respective VM, you can use "Extension" mechanism while VM creation where you will attach power shell scripts.

5. So from next time, after deallocating your VM, whenever you will start that old VM again it will read that temp file where all the file name and process name was listed and opened that.

This way, you can achieve your hibernation process.

Hope you are clear with this hibernation steps else update me so i can guide you better ways.

Prem Prakash
  • 203
  • 2
  • 12
  • 1
    This is cool except it doesn't preserve the state of each process. – sharptooth Jul 24 '17 at 11:32
  • You can tweak your startup application to do as you want. Basically if we follow above steps, end users doesn't end to worry about what all files and application was running last when vm stopped. User will get all same on start as it was on stop. – Prem Prakash Jul 25 '17 at 12:06
  • Yeap, but that requires that the application is able to restart and with hibernation it just resumes without restarting. – sharptooth Jul 25 '17 at 12:12
  • This we can do using power shell script where u can add that application in startup of that vm. That will solve the purpose. – Prem Prakash Jul 26 '17 at 13:07
  • How would I restore the edit history in Notepad using this approach? – sharptooth Jul 26 '17 at 15:18
  • So that application will keep polling in infinite loop to scan task manager and recent file and that notepad will keep update with last running information over that vm. So next time when that vm start again. That startup application will look for that file and open up or launch all the files and application which has been listed into that notepad file. – Prem Prakash Jul 27 '17 at 16:08
  • Yeah, cool, Notepad will have that very file open but how will the edit history be preserved? – sharptooth Jul 28 '17 at 08:44