This is a blog on all things Microsoft that I could not find the answers for when I looked. I hope that by my documenting the fix, I save you the hassle!

Thursday, July 29, 2010

VirtualBox

I am presenting at Exchange Connections 2010 later this year, and I need to set up some demo machines. I need my demo to run Exchange 2010, which is a 64bit application and I do not have guaranteed internet access so I cannot run my demo’s via my lab machines in the UK.

But I cannot use Virtual PC 7 installed on my Windows 7 laptop. And I do not want to reinstall my laptop with Windows 2008 Server to allow me to run Hyper-V.

So I have installed Oracles VM desktop product, VirtualBox. And this blog is just to describe how to do what we know as base images and differencing files in Virtual PC/Hyper-V on VirtualBox, and to use the VHD disk format which VirtualBox supports so that I have the option of moving my virtual servers between Virtual PC (if it ever supports x64 guests), Hyper-V servers and VirtualBox.

So to create a new VHD hard disk for use in VirtualBox open a command prompt, change to the directory in which you installed VirtualBox (probably C:\Program Files\Oracle\VirtualBox) and run the following command:

This will create a dynamically expanding hard disk in the location specified, in the Microsoft VHD format, and 130048KB (127GB).

Next you create a new virtual guest in the VirtualBox application (or via the VBoxManage command line if you wish) that uses this existing disk.

Boot this virtual guest, and then install the required OS and patches etc. Once this guest is ready to be a base image you can shut it down. If you are going to use this base images as a Domain Controller then you need to reset the SID’s on the device using either NewSID from Sysinternals or Sysprep before you move onto the next step.

Now that you have the base image, you need to mark it as such in VirtualBox. This is done from the command line:

VBoxManage modifyhd "path\filename.vhd" --type immutable

And then you need to delete the virtual guest settings that you used to create this disk. This disk is not deleted.

To create the virtual guests that use the “immutable” disk (aka parent/base disk) in Virtual PC/Hyper-V you would need to make a second disk, but not in VirtualBox. Here you just use the same disk. As you have marked it as immutable a snapshot disk will be created (in the .VirtualBox folder of your profile) and all changes will be written to this disk instead.