Lars Nielsen's Discoveries

December 16, 2010

Virtual Box and Xen Server

Filed under: Architecture,SharePoint — Lars Nielsen @ 9:12 pm
Tags: , ,

We had some fun (not really) recently getting Sun Virtual Box to run on Citrix Xen Server.

Virtual Box is a powerful virtual machine environment which I was converted to by some colleagues who told me it’s better than Virtual PC which is what I always used to use for SharePoint development.   Initially I was sceptical but I did find it faster and more stable, less prone to crash and suffer corruption on the virtual hard disk.  The biggest problem I had in setting it all up was that there is no obvious way to set up differencing disks.   Differencing disks are a really useful feature of Virtual PC that make it possible to have multiple machines based on the same base image.  I find this really useful.  You can even create a separate virtual machine for every project, and leave each one in a saved state ready to fire up with Visual Studio open with the project code already loaded in.

It took a while to work out how to get Virtual Box to do the same thing.  Virtual Box has snapshots, but these aren’t quite the same thing because you can’t branch off multiple machines off the same base.  I finally found out how to do it by following these steps.    I set the base virtual machine hard disk image with all the basic applications that I need, updated with all the service packs etc.  Then I set it to be immutable (read-only) and actually physically set the VDI file to be read-only as well, so I know it’s always going to be intact.  Then I create separate machines each with their own differencing disks.

Well this was all well and good on a desktop machine, but in a corporate environment, it’s obviously a disk to have  critical files on your desktop (especially if it’s a 15GB VDI file!).   But at the same time I can imagine how Virtual Box would run very slowly if its hard disk files were located on a network share, so the VDI files really have to be on the hard disk.  So we tried to set up a developer server on Citrix Xen Server, the idea being that I’d run Virtual Box on that server instead of the desktop.

Virtual Box installed no problem as a 64 bit app on the 64 bit server.  Trying to fire it up, however, was a different matter.  The Virtual Box application ran fine but at the first attempt to open up a completely empty virtual disk file (with no operating system on it) the server CPU spiked up to 100% and stayed there, freezing the server until it was rebooted.  It seems it’s not easy to get Virtual Box  to run inside another virtualization platform – there’s a discussion about this on the Virtual Box forum.   There are plenty of people complaining about this problem but none of the solutions I found seemed to work.  I tried disabling USB support, allocating more video RAM, disabling the clipboard sharing, disabling IOAPIC, giving the Virtual Box process a lower priority and setting the processor affinity to one core.  No joy – I still got the same behaviour even with a completely blank disk.

So for now I’m forced to conclude that Virtual Box is not happy running inside a Xen Server VM, but if anyone has got around this problem please post your answer here!

(You might reasonably ask why should you want to run a virtual machine on a virtual server, why not just forget about Virtual Box and use Xen as the virtualization platform.  The answer is that in many organisations the infrastructure team looks after the virtual servers, and developers want complete control over the virtual machines – to be able to branch off multiple machines, take snapshots, etc. – without having to ask the server team who are usually hard pressed looking after customers).


Blog at