Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?
share|improve this question

3 Answers 3

up vote 4 down vote accepted
  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.

share|improve this answer
    
+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 6:13

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.