2

In vSphere 5.1.0 I have created a snapshot of a windows 7 machine. I would to restore the machine to this snapshot each time its restarted. But it only seems to be possible if I manually go to the menu and select Revert to current snapshot.

How do I force the machine to restore to the snapshot each time its rebooted?

2
  • Can you give some more context? Why do you want the server to operate in this manner?
    – ewwhite
    Jan 28, 2014 at 17:27
  • 1
    @ewwhite I worked in application support and our sales guys constantly wanted demo systems. To avoid support headaches I used the answer below to set systems up so if they called and complained it was broken, I could simply power the VM off and back on again and it was back to the base config. Jan 28, 2014 at 17:32

2 Answers 2

8

What I would recommend is setting the VM to a non-persistent hard drive once you have it configured the way you want your 'base system' to look like. I did this with several machines for demo purposes so that if the sales guys fouled the demos system up, all I had to do was shut the system down and restart to go back to a 'day zero' configuration.

In the VM's configuration, once your vm configured where you want it to 'restore' to, power down the vm and open the settings. On the hard disk settings under 'Mode' select "Independent" then "Non persistent". Doing this you will most likely have to delete the snapshot you've already taken but this will allow you to run the VM and all of the changes to the system will be stored in a separate temporary disk file that is deleted when the VM is powered off.

If you wish to update your vm base image later, simply power down, change the mode to Persistent then power it up and make your changes. Once changes are done, power down and repeat the to set it back to Non-persistent.

There's a lot of good documentation out there but I highly recommend the VMware documentation center: http://pubs.vmware.com/vsphere-55/index.jsp

I know you are on 5.1.0 but the disk modes have been the same for a while now. Here is a direct link to disk modes with brief explanations:

Disk Modes

7
  • Ok so the point it to actually NOT make a snapshot? I appears to me that the move only work when I shutdown the machine from vSphere or from inside windows. If I choose "Restart" its not restored to its original state.
    – u123
    Jan 28, 2014 at 21:25
  • Correct, once the VM is powered off it will delete the temporary changes. This allows for applications to be installed that require a 'restart'. Jan 28, 2014 at 21:26
  • But as a result the only way I can start the machine from the clean state again is through vSphere. I have also tried "shutdown /r /t 0 /f" But its not restored to the clean state when it starts up. Is it possible to get it to restore the state and also reboot automatically?
    – u123
    Jan 28, 2014 at 21:34
  • What is the use case here? Why do you need it to revert on a restart? Jan 29, 2014 at 0:18
  • The machine is part of a CI setup where I need to make sure that its state is absolutely identical before each test is executed on the machine. I would like to do this automatically so I don't have to manually start the machine.
    – u123
    Jan 29, 2014 at 7:32
0

Another potential idea I've used in the past is to snapshot a running machine, choosing to snapshot RAM and quiesce the filesystem. Instead of powering off, just revert by hand.

The difference is that while it's still one operation, the host returns quickly to a running state and can be more easily reverted/updated/snapshotted later, deleting the now-older snapshot once the updates/changes in the box pass QA.

Watch if you're doing this - like me - to text a PXE environment: [esc][enter] should reload the PXE menu, required to use any new options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .