5

We're running Hyper-V on Windows Server 2008. I have a production environment VM for which I'm planning some major application upgrades. These upgrades are completely within the VM (not at the host level) and are not related to the OS.

I'd like to clone the production VM so I can test the upgrade procedure without affecting active users.

So my questions are:

  1. what's the easiest way to clone the production machine?
  2. When I do the actual upgrade, is a VM snapshot a good way to make a just-in-case backup? What does a snapshot not protect me from?
Michael Haren
  • 1,301
  • 7
  • 18
  • 31

3 Answers3

4
  1. shut down the machine and export. To replicate the machine copy the export folder into your Hyper-V directory and import it. NB you can only import once, so import a copy!

  2. yes.

JR

Re Michael's question: You can't export a machine without shutting it down first. You could snapshot it (e.g. www.drivesnapshot.de) and then restore the snapshot to a new machine with disks of the same size. However when you boot it the new VM will think the original network card(s) have been removed and replaced with new one(s). Not a big deal, but you'll be left with a ghost network card that's hard to remove, just as if you had fiddled with the network cards in a real PC.

I would shrug and shut down the PC to use an export. It takes only the time needed to make a copy of the hard disk file(s), which can be a while if they're big.

John Rennie
  • 7,776
  • 1
  • 23
  • 35
  • +1 for being very easy on me. Any way to minimize the impact on the running machine (e.g., not require it be stopped)? – Michael Haren Jul 17 '09 at 14:09
  • See my edit. Shutting down and exporting is easiest. At least you only need to do it once. – John Rennie Jul 17 '09 at 14:58
  • Seconded. export the virtual machine, and attempt the upgrade on the exported copy. – icelava Jul 17 '09 at 15:07
  • As part of this step, I assume it'd be a good idea to disable the new VM's network interface before I start the machine (to avoid name conflicts on first boot while I change it's network name)? – Michael Haren Jul 17 '09 at 17:14
  • 1
    I would simply change the NIC to an internal virtual network. That will prevent the network seeing the duplicate name. NB, in fact NBBBBBBB, if a domain is involved run sysprep (or the SysInternals SID changer whose name escapes me). Don't just change the name. If you don't run sysprep you'll get a duplicate machine GUID and it will cause you problems on the domain. – John Rennie Jul 18 '09 at 06:13
  • Thanks for the followup. I ran sysinternals's newsid tool on all the clones this morning. – Michael Haren Jul 28 '09 at 12:30
  • A note for future readers: the newsid tool is no longer recommended. It doesn't hurt anything but simply isn't needed any longer. – Michael Haren Jun 20 '11 at 18:45
1

1) You can do as John described, if the OS is 2008, you can perform a server backup while the server is running, and do a complete bare metal restore on a new VM, depends on your needs, or use 3rd party imaging utilities.

Personally i would go with Johns, way of exporting the VM.

Regarding #2, snapshots are handy, but do note that they will start making differential disks, which keep on growing, instead of the primary vhd you specified on the creation of the VM.

When you delete snapshots, and the UI indicate they are gone, they are infact still being used in the background until you perform a complete shutdown of the VM itself, at which point the merge will happen.

This has bitten me in the butt several times, since you need the double free space that you current VM uses (Like VM is 100GB, you need a total of 100GB free to merge).

If it runs out of space it pauses the VM, while in the merge process.

Just be aware of how it works, they can be nice for quick snapshots while testing stuff, but do remember to delete them (and shutdown the VM to get them merged back into the main VHD file) after they served their purpose.

MNJ
  • 36
  • 2
1

I agree with the above answer. Here is an additional article that provides a little more information.

Jason Z
  • 111
  • 4