J e r o e n ' s   w e b l o g

Copying virtual machines made easy (sort of)

As I mentioned in my previous post on Virtual Server 2005, it's very easy to create a base virtual machine that contains (for instance) a fully patched version of Windows XP Pro and copy it around to work with multiple instances since all a VM really is is just a .vmc (Virtual Machine Configuration) and .vhd (Virtual Hard Drive) file. Making a copy of a VM is just a matter of creating a new machine in the Virtual Server web interface and copying the .vmc and .vhd files over the ones created. The only changes required are two values in the .vmc xml file: one pointing to the absolute path of the .vhd file to use and another that points to the relative path of the same file (in my experience if you change only one of these it will use the absolute path, don't ask how I discovered that, it wasn't very funny, especially the part where throwaway.vmc's VM wrote to donttouchthisbaseimage.vhd). After that you can start up the just created VM and it'll be a copy of the base image.

One problem remains however: machine name. This didn't seem like much of an issue, but having multiple instances running will mess with file sharing, besides producing annoying error messages. Fortunately, there's a solution to this, one that's probably known to system administrators but not to a developer like me. What you need is deploy.cab in /support/tools on the Windows XP or Windows 2003 installation disk. Install the files from this archive on the base image and first run setupmgr.exe. This tool will help you create a sysprep.inf file. First you choose to do a fully automated install, next select the options you want to automatically configure on a copied image, like generating a machine name. When you're done the tool will have automatically created a sysprep-directory with the sysprep.inf file in it (it will ask you to save the sysprep.inf file but regardless of where you save it, it will also place it in the correct directory).

Next you can run the sysprep.exe tool. Here you choose to do a mini-setup and click "Reseal". This will freeze the VM shortly and then shut down. Now you can create a copy of the virtual machine. When you boot into that copy for the first time, you'll see an automated configuration taking place and a reboot, after which the virtual machine is done: fully customized with a unique machine name! This is especially useful if you plan to do automated resets of a virtual machine using a script or a custom application: just copy the .vmc/.vhd files and change the path in the .vmc file. After that you're set to start over again from scratch. This might seem like a far-fetched solution, but being able to select what to automatically set during configuration and what to ask the user is very useful: for instance setting the localization during setup can be used to test localized versions of your application without having to maintain a bunch of localized base images.

A note on licensing though: I've called Microsoft to ask about licensing in such a scenario and they've told me that my MSDN Universal subscription is enough for doing it like this when I'm the only user of the virtual machines. I'm not a lawyer so I can't say anything about what you're allowed to do in other situations/with other licensing schemes.

Posted: Aug 03 2005, 04:15 PM by jvdbos | with 59 comment(s)
Filed under:

Comments

Justin said:

If you are looking for base images, I would look in differencing disk. What you can do is create a vhd that has for wxample a fully patched version of XP that I call the base image. Then you can create a 2nd vmc with a differencing hard disk and use the base image as the parent. When you create a differencing disk, it will ask for the parent.

Make sure though to make the base image read-only as changes to it will break all of the vmc that reference it. The use of differencing disk has saved me a ton of disk space since it only stores the differences between the base image. It also makes it very easy to create new vmc without having to copy files around.

After you have created the child vmc above, you will want to also run NewSid from SysInternals to change the machine name and all of the SID info. NewSid does the same this as sysprep but it is much easier. With NewSid you just run an exe tell it the new machine name and click next and it does the rest.

As well dont forget to install the Virtual Server Additions.
# August 3, 2005 12:25 PM

DaveTrux said:

Another pitfall with copying virutal machines is the MAC address. If you simultaneously run multiple copies of the same VM with the same MAC address you will have strange network problems. Sysprepping the VM is not enough. You can fix the MAC address in the .vpc file by removing data between the ethernet address tags, see my post below:

http://dotnetjunkies.com/WebLog/davetrux/archive/2005/02/22/56204.aspx
# August 3, 2005 3:09 PM

Jeroen van den Bos said:

Justin: Thanks for the information! I will look into using differencing disks as an alternative, although I have to say that installing third-party applications is something I would like to avoid - the images are used for testing application compatibility and deployment and I want the images to be as clean as possible.

I.e. I want to avoid having users on the phone and eventually recommending they install NewSid :-)

DaveTrux: I haven't had these problems yet, but I will see if it works the same way with Virtual Server and adjust my code accordingly.
# August 4, 2005 1:34 AM

ganeshwar nayak said:

this does not interest me at all i rate it  "1/2 on 5

# October 23, 2007 9:57 AM

vmc vhd said:

Pingback from  vmc vhd

# June 5, 2008 1:11 AM

help creating new machines quickly | keyongtech said:

Pingback from  help creating new machines quickly | keyongtech

# January 21, 2009 10:19 PM

red_bdiz.ru said:

Have full written, is about what to think. Representation fuller became.

To the author of thanks.

# December 17, 2009 4:35 PM

Dillonnsery said:

I was search for <a href=www.lamps-lighting.com/.../2420MD-BK.html> Designers Fountain The Tiverton 2420MD-BK </a>

and found this post.  I would say that you have answered my question thanks

# April 15, 2011 10:21 PM

Silasoserf said:

I was search for <a href=http://www.sehomeneighbors.com> justin bieber </a>

and found this post.  I would say that you have answered my question thanks

# April 22, 2011 9:50 PM

Kendraxserz said:

If your looking for information on watches, check out <a href=http://www.citizenwristwatches.com>Citizen Watches</a>

# May 2, 2011 7:35 PM

Kendrausern said:

If your looking for information on watches, check out <a href=http://www.citizenwristwatches.com>Citizen Watches</a>

# May 3, 2011 3:43 AM

Averytserb said:

I was search for <a href=www.lamps-lighting.com/search.php Lighting Napa</a>

and found this post.  I would say that you have answered my question thanks

# May 3, 2011 11:22 AM

Saundramserw said:

I was search for <a href=www.innovatepa.org/fendihandbags.html>Fendi Handbags</a>

and found this post.  I would say that you have answered my question thanks

# May 3, 2011 8:53 PM

Aldouserh said:

I was search for <a href=www.innovatepa.org/>Prada Handbags</a>

and found this post.  I would say that you have answered my question thanks

# May 4, 2011 11:24 AM

Augustusnserq said:

I was search for <a href=www.keyphonesdirect.com/.../DKT3001-REF.html>Toshiba DKT3001</a>

and found this post.  I would say that you have answered my question thanks

# May 5, 2011 11:53 AM

buy essays said:

Your stuff about this post is very gripping. I would probably opt for the term paper writing service to buy custom essay papers and buy term paper about this post, because that’s the good way.

# May 6, 2011 11:24 AM

Estelapserb said:

I was looking for information on <a href=www.gohobbies.com/rc_cars-trucks.html>RC Cars</a> and its very helpfull. Anyone know any other sites?

# May 7, 2011 3:29 PM

Jameyvserm said:

<a href=www.gohobbies.com/rc_boats.html>Remote Control Boats</a> Are an awesome hobby. If you know anything about rc boats please let me know

# May 9, 2011 4:57 PM

Jeneepserp said:

If you ever want to buy a <a href=www.gohobbies.com/rc_airplanes.html>Remote Control Planes</a> That is a great spot. They have all hobbies.

# May 10, 2011 4:01 AM

Nathanialsserf said:

Does anyone have a recomendation for a good <a href=www.gohobbies.com/rc_helicopters.html>Remote Control Helicopters</a>

# May 11, 2011 2:36 AM

forum posting service said:

Some time ago I was hired at forum posting service. I state that only professionals can to perform submission stuff.

# May 11, 2011 5:18 AM

buy essays online said:

Nobody wants to be a looser. Thus, do not hesitate and ask: " write my paper ". It should save your grades.  

# May 12, 2011 8:59 PM

Taylorwsery said:

If you are looking for any information on <a href=www.gohobbies.com/rc_boats.htm>lRemote Control Boats</a> look no further!

# May 17, 2011 9:21 PM

Jarvisrserl said:

If you are looking for any information on <a href=www.gohobbies.com/rc_airplanes.html>RC Planes</a> i have found the best spot ever.

# May 20, 2011 12:14 AM

Donovankseru said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 20, 2011 12:02 PM

Gennyfserf said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 20, 2011 11:13 PM

Sherrilzserh said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 21, 2011 11:11 AM

Garlanddserg said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 22, 2011 10:51 AM

Donovanfserz said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 22, 2011 7:34 PM

Marlindserz said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# May 23, 2011 5:22 PM

Myrtiseserp said:

I was search for <a href=www.lamps-lighting.com/.../2672-MRBZ.html> Maxim Lighting Stratus 2672-MRBZ </a>

and found this post.  I would say that you have answered my question thanks

# May 23, 2011 11:08 PM

Dillondserx said:

I was search for <a href=www.lamps-lighting.com/.../M2121-22.html> Thomas Lighting Pompeii M2121-22 </a>

and found this post.  I would say that you have answered my question thanks

# May 25, 2011 1:17 AM

Faviolaksern said:

I was search for <a href=www.lamps-lighting.com/.../1-0150-6-76.html> Savoy House Lighting Southerby 1-0150-6-76 </a>

and found this post.  I would say that you have answered my question thanks

# May 25, 2011 9:51 PM

Kirbybsers said:

Looking for infoatmion on <a href=www.gohobbies.com/rc_boats.html>Remote Control Boats

</a> I found this great hobby site

# May 25, 2011 11:13 PM

Silasaserx said:

Want some information on <a href=www.gohobbies.com/rc_airplanes.html>RC Planes

</a> be sure to check these guys out.

# May 26, 2011 4:14 PM

Lawanadserf said:

I was search for <a href=www.lamps-lighting.com/.../N6007-476.html> Metropolitan Casa Cristina N6007-476 </a>

and found this post.  I would say that you have answered my question thanks

# May 27, 2011 9:22 PM

Omarpserw said:

I was search for <a href=www.gohobbies.com/.../7051X.html> Traxxas 7051X Steel Driveshaft(4):1/16 Slash </a>

and found this post.  I would say that you have answered my question thanks

# May 28, 2011 9:02 AM

Dillonosery said:

I was search for <a href=www.gohobbies.com/.../5020.html> Calandra Racing 5020 Carbon Fiber Camber Guages </a>

and found this post.  I would say that you have answered my question thanks

# May 28, 2011 11:42 PM

Faustinodserf said:

I was search for <a href=www.gohobbies.com/.../P5540.html> Dynamite RC P5540 DPS 18RE </a>

and found this post.  I would say that you have answered my question thanks

# May 29, 2011 2:40 PM

bserf said:

I was search for <a href=www.gohobbies.com/.../30013203S.html> Evolution Engines 30013203S Exhaust Coupler:45GX,58GX,116GX </a>

and found this post.  I would say that you have answered my question thanks

# May 30, 2011 5:28 PM

Randellvsero said:

I was search for <a href=www.gohobbies.com/.../55676.html> Excell Hobby Products 55676 Saw </a>

and found this post.  I would say that you have answered my question thanks

# May 31, 2011 7:20 AM

Corrinnedseru said:

I was search for <a href=www.gohobbies.com/.../2013.html> WS Deans 2013 Male Pigtail </a>

and found this post.  I would say that you have answered my question thanks

# May 31, 2011 5:13 PM

Franciscowserk said:

I was search for <a href=www.gohobbies.com/.../2025.html> Dave Brown RC 2025 Motor Mount: .20-.25 </a>

and found this post.  I would say that you have answered my question thanks

# May 31, 2011 10:44 PM

Nathanialuserq said:

I was search for <a href=www.gohobbies.com/.../813.html> Dubro Products 813 Fuel Line Barb </a>

and found this post.  I would say that you have answered my question thanks

# June 1, 2011 4:12 AM

Corrinneeserc said:

I was search for <a href=www.gohobbies.com/.../30533.html> Axial Racing 30533 AX10, Scorpion </a>

and found this post.  I would say that you have answered my question thanks

# June 1, 2011 9:37 AM

userr said:

I was search for <a href=www.gohobbies.com/.../104969.html> HPI Racing 104969 Mud Flap Set (2): Baja 5SC </a>

and found this post.  I would say that you have answered my question thanks

# June 1, 2011 3:07 PM

nserd said:

I was search for <a href=www.gohobbies.com/.../4656.html> Hangar 9 4656 Carden Edition, 89", Yak 54 </a>

and found this post.  I would say that you have answered my question thanks

# June 1, 2011 8:25 PM

jserb said:

I was search for <a href=www.gohobbies.com/.../A99124.html> Team Losi A99124 Repl Tip, 5/64", 2.0mm: 8 in 1 </a>

and found this post.  I would say that you have answered my question thanks

# June 2, 2011 1:58 AM

Octaviofseru said:

I was search for <a href=www.gohobbies.com/.../87046.html> Tamiya 87046 Brush </a>

and found this post.  I would say that you have answered my question thanks

# June 2, 2011 7:29 AM

Taylorfserw said:

If you are looking for any information on <a href=www.gohobbies.com/rc_boats.htm>lRemote Control Boats</a> look no further!

# June 3, 2011 3:08 PM

Jarvisfserj said:

If you are looking for any information on <a href=www.gohobbies.com/rc_airplanes.html>Remote Control Airplanes</a> i have found the best spot ever.

# June 3, 2011 8:50 PM

Donovanjserk said:

I was search for <a href=www.gohobbies.com/.../E182TD.html> Saito Engines E182TD 182 Twin Cyl Dual Plug Muffler:DD </a>

and found this post.  I would say that you have answered my question thanks

# June 4, 2011 2:37 AM

Gennyxserf said:

I was search for <a href=www.gohobbies.com/.../B1829.html> Team Losi B1829 TransCsMotorPlate&BraceSetMini-T </a>

and found this post.  I would say that you have answered my question thanks

# June 5, 2011 11:43 AM

Sherrilfsere said:

I was search for <a href=www.gohobbies.com/.../30941321.html> Evolution Engines 30941321 Carburetor Flange 26/35GT </a>

and found this post.  I would say that you have answered my question thanks

# June 5, 2011 5:51 PM

Shanellejsere said:

I was search for <a href=www.gohobbies.com/.../77.html> Mascot Precision Tools 77 Drill Bit, (12 Pieces) </a>

and found this post.  I would say that you have answered my question thanks

# June 5, 2011 11:52 PM

weblogs.asp.net said:

421441.. Bang-up :)

# June 9, 2011 6:13 PM

Marilyn Oliver said:

Hey, I just hopped over to your internet site via StumbleUpon. Not somthing I would generally read, but I liked your thoughts none the less. Thanks for producing something worth reading.

# July 8, 2011 4:02 AM

Keciafserp said:

I was search for <a href=www.keyphonesdirect.com/.../a>

and found this post.  I would say that you have answered my question thanks

# July 14, 2011 6:26 PM

Logo design said:

Nice work. Please keep us informed with such useful information.

# January 5, 2012 7:20 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)