VirtualBox
In my last post about virtual machines I talked a little about the two virtualization solutions that I’ve played with on Windows: Microsoft’s VirtualPC and VMware’s VMware Workstation. Shortly after that post, I came across another virtualization package that nicely bridges the gap between Microsoft’s free-but-feature-poor solution and VMware’s feature-rich-but-not-free solution. The new contender is Sun’s VirtualBox.
The purpose of VirtualBox is the same as VirtualPC and VMware Workstation — that is to provide you with a virtualized, isolated computer on which you can install and run any operating systems and applications you choose. You basically get a computer within your computer (see my previous post in which I explore some of the cool things you can do with such an environment).
The most exciting thing about VirtualBox is that it is free (open-source even) yet has a number of features that were previously only available in commercial products.
USB Device Support
One of the biggest limitations of VirtualPC is that it has no USB device support. Other than the mouse and keyboard, any USB devices you have are completely invisible to the virtual machine. If you have a need to access a USB flash drive or printer from virtual machine, it’s critical your virtualization software have USB support.
With VirtualBox, any USB device connected to the host machine can be exposed to the virtual machine. As long as you have the appropriate drivers installed on the virtual machine, the device should behave just as it does when connected to the host.
In the screenshot above, I’ve got a USB WiFi adapter connected to my Linux Backtrack VM. Note that, when you “connect” a USB device to a virtual machine, it is no longer accessible to the host machine — devices are only visible to one environment at a time.
Seamless Windows
VirtualBox allows VMs that are running certain operating systems to be run in seamless window mode. With seamless windows, the application windows that would typically be displayed within the virtual machine are instead rendered as if they were running natively on the host machine.
On the Mac, I know that both VMware Fusion and Parallels Desktop support this sort of seamless window mode, but this is the first time that I’ve seen it in a virtualization product that runs on Microsoft Windows.
Here is a screenshot of a Windows XP VM running in standard mode. Note that the VM is contained completely within a window running on my Vista host desktop. You can see that I’m running Notepad and Calculator in the virtual machine but they’re trapped within the VM window.
The following screenshot shows exactly the same environment running in seamless window mode. Note that the virtual machine window is gone — Notepad and Calculator now look as if they’re running on the host machine even though they’re still completely sandboxed in the VM.
One interesting side-effect of the seamless window mode is that you end up with two taskbars: one for the host machine and one for the virtual machine.
If you have applications from both your host machine and virtual machine that you want to run side-by-side, seamless mode can really help to make more efficient use of your desktop real estate.
Virtual Disks
All of the virtualization solutions support some form of virtual disks that can be attached to the virtual machine. In VirtualPC, these disks are called Virtual Hard Drives and have a .vhd extension on the host system, in VirtualBox they are called Virtual Disk Images and have a .vdi extension.
In my previous post, I talked about the “Undo Disk” feature in VirtualPC and how it can be used to create a read-only virtual machine (actually, you can write changes to the virtual machine while it’s running, but all those changes are lost as soon as you shut it down). VirtualBox supports a similar feature called immutable images.
Immutable VDIs are read-only and can be attached to multiple virtual machines simultaneously. At run time, any requests to write data to the immutable disk are directed to a special “differencing disk” created on the fly by VirtualBox. Much like VirtualPC, VirtualBox completely discards any data written to the differencing disk when the VM is shut down.
Immutable disks are handy when you don’t care about saving the state of your VM, however in certain scenarios you’ll probably want your VM to persist its state so that you can come back to it later. I have VMs I’ve created for the different development environments that I use regularly: one with IIS and Visual Studio for .NET development and one with Tomcat and Eclipse for Java development. Since I’ll have source code in these virtual machines that I’m actively working on, I wouldn’t want to configure them with immutable disks — doing so would mean that I’d lose all my code changes whenever I shut down the VM. In VirtualBox, disk images that allow write access are called “normal images”.
One of the nice features of the normal disk image is the ability to save snapshots of the state of the virtual machine. At any time you can revert to one of your previous snapshots even if you’ve made significant changes to the virtual machine since you took the snapshot.
Once I’ve got the operating system, service packs and necessary applications installed on a virtual machine, I’ll typically take a snapshot and label it something like “Clean install w/ applications”. That way I can always revert back to that snapshot if the VM is ever damaged by an accidental change, malicious software or other corruption.
The screenshot above shows the details of a VM snapshot I took after installing Windows XP and its associated service packs. Even though I’ve made changes to the VM since taking this snapshot I will always be able to roll my system back to this state if needed.
You can sort of accomplish the same thing in VirtualPC by manually making copies of the .vhd file (these become your snapshots), but having this feature built into the application makes it much more user friendly.
Missing Features
Unfortunately, VirtualBox isn’t quite perfect. There are at least two features lacking that I really miss from VirtualPC: 1) Drag-n-drop support between the host and virtual machine, and 2) GUI management tools.
One of the great ease-of-use features in VirtualPC is the ability to drag-n-drop files between the host machine the virtual machine. If you have a document or application on your host machine that you’d like to access, you simply drag it into the VM window and it will create a copy within the VM. Similarly, moving files from the VM to the host is accomplished by simply dragging the file from the VM and dropping it on the host desktop.
With VirtualBox, the process of moving files between the host and VM isn’t nearly as straightforward. VirtualBox allows you to select a folder on the host machine which it will then expose as a network share to the virtual machine. You can then map that network share to a drive letter and copy files back-and-forth. It’s a bit of a hassle if you’re just looking to quickly move a file between environments.
My only other complaint about VirtualBox (and this is arguably a pretty minor one) is that many of the advanced features are only accessible via command line tools. If you want to compact your virtual disks or configure an immutable disk, you have to go to the command line to do it. Overall, the VirtualBox UI is very clean and usable, so it seems a bit arbitrary when you find certain features are presented nicely in the UI while others require that you go to the documentation to find the appropriate command line option.
Despite these minor faults, VirtualBox seems to be a solid product and is probably going to be taking the place of Microsoft’s VirtualPC on my systems here very quickly. I look forward to seeing what Sun does with this product in future releases.

2 Responses to “VirtualBox”
QUOTE:
Immutable VDIs are read-only and can be attached to multiple virtual machines simultaneously. At run time, any requests to write data to the immutable disk are directed to a special “differencing disk” created on the fly by VirtualBox. Much like VirtualPC, VirtualBox completely discards any data written to the differencing disk when the VM is shut down.
Do you know something about saving snapshot from immutable disk?
Thanks in advance.
One of the key differences for me between VirtualPC (2007) and VirtualBox is speed. I find that on XP, my VirtualBoxes are much faster than my VirtualPC boxes. VirtualBox also uses less memory and doesn’t hog resources like VirtualPC does.
I started with VirtualPC 2007 but when I found I had trouble installing a number of Linux systems, particulary anything Ubuntu for some reason, I started looking for an alternate solution. Qemu wasn’t the answer (had the most trouble with this one) but VirtualBox was. VirtualBox has been so great, I haven’t even bothered to look into VMware.
Now I run a number of lightweight Linux distros, mostly when I surf – for the added security. Even a number of middleweight distros can be run all day long without a huge performance hit on a modern system (1gb memory).
Leave a Reply