TechTip: Sun's Open-Source VirtualBox Rivals VMware Workstation

Linux / Open Source
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Sun's free VirtualBox is a great product for desktop virtualization, and you can't beat the price!

 

Originally released in January of 2007 by a company called innotek, VirtualBox is an open-source desktop virtualization product. In 2008, the company was acquired by Sun Microsystems, and since then, Sun has spent an incredible amount of time developing a very stable, easy-to-use virtualization platform.

 

For quite some time, I've been a huge fan of VMware products. All of my virtual machines in the enterprise mission-critical environments run on VMware ESX solutions. At the desktop level, VMware Workstation and VMware Server (the free product) are deployed where systems aren't as critical. All of these VMware products have been very stable, with the exception of VMware Server, the free product, as of late. Given some of the bugs with VMware Server, I slowly and hesitantly switched over from VMware Server to VirtualBox and have been quite pleased.

Supported Systems and Licensing

VirtualBox supports just about every well-known OS out there. You can run it on Windows, Mac OS X, Solaris, and OpenSolaris, as well as all the many Linux flavors, like Ubuntu, Debian, OpenSuSE, SuSE, Red Hat, and many more. The only issues with all of the various precompiled binaries are a few licensing concerns, but they aren't complicated and can be bypassed by using the open-source edition.

 

A complete list of the binary installers exists already for all of the systems listed above. The two conditions that exist with use of these binaries are that you can use the installation only for personal, educational, or evaluation use and that you cannot redistribute the binaries. If you want to use VirtualBox in an enterprise environment, you can contact Sun to purchase enterprise licenses. These also provide you with more features than the free version.

 

The open-source edition is provided in the form of source code from the downloads section of the Web site. This edition is completely open source and covered under the GPL, so it's yours to use as you wish. Once downloaded, you can find build instructions for Windows, Linux, Mac OS X, and Solaris. To get a feel for the software, I suggest using the binaries under the evaluation license before you compile and install the software, since the binaries are easier to install.

Features and Benefits

Similar to many of the other leading virtualization technologies, VirtualBox can be considered modular in design. For instance, you can start a machine in the GUI interface and then control it with the command line VBox tools included with the program. All virtual machine configuration files are stored in XML format, so you can easily copy configurations to other servers if you wish. Similar to VMware, Sun uses what it calls Guest Additions to add software drivers into the virtual machine, providing improved performance during run time.

 

One of my favorite features is the ability to share folders between the guest and the host OS. This capability allows you to access your files on your local desktop from the virtualized guest machine. USB support is included, which is nothing miraculous in and of itself; however, USB over Remote Desktop Protocol (RDP) protocol is an interesting feature. When you put the guest machine into RDP mode, others can access the machine remotely along with any USB devices plugged into the virtual machine. Also, snapshots give you the ability to save the current machine state in case you want to test software, giving you the ability to roll the machine back in the event of failures.

 

VirtualBox supports creating a lot of different virtual machine operating systems. For Windows systems, everything from Windows 3.1 to Windows 7 is supported. You can install around 10 distinct Linux types or simply use a generic Linux kernel series. Solaris, OpenSolaris, and BSD are supported, along with IBM OS/2 systems. And you can even install DOS or NetWare systems.

GUI Interface

The graphical interface is actually very simple to use. There are hardly any menus to deal with, making the user experience very smooth. Creating a new virtual machine is a breeze with VirtualBox's wizard interface. The creation wizard walks you right through the process of choosing an OS type, creating a new hard disk, or using an existing image. Once you've created the virtual machine, you can edit settings, create or edit hardware, and disable or delete devices that you don't want on the system. All hardware settings can be edited or viewed by highlighting the virtual machine and choosing Settings or by clicking on the appropriate section to the right of the main GUI interface.

 

121809Maximage1
Figure 1: Edit or view hardware settings from the VirtualBox main window. (Click images to enlarge.)

 

VirtualBox makes use of its disks and other forms of media, such as ISO images, in its version of VMware's datastore. You can access the VirtualBox Media Manager from the menu under the File button. From here, you can add and delete disk images already on the system or add and delete images to be utilized as CD/DVD or floppy images.

 

121809Maximage2

Figure 2: Add and delete images from the VirtualBox Media Manager.

 

Another feature is the ability to import or export a virtual machine as an appliance format. VirtualBox supports the Open Virtualization Format (OVF) for use with packaging and distributing virtual machines. You can export currently installed systems using the export feature from the menu as well as import any virtual appliance you obtain that uses the OVF formatting.

 

Creating shared folders between the host and the guest OS is very simple as well. The only caveat to it is to ensure you mount the share from within Linux; and from within Windows, you need to map the connection you have set up. The commands necessary to mount and map the shares are shown to you directly in the Shared Folders menu.

 

121809Maximage3
Figure 3: Mount and map shares from the Shared Folders menu.

Command Line Interface

While the GUI removes many of the features of VirtualBox, the command line gives you complete access to everything it can do. You can create, modify, and delete virtual machines. Disk and floppy mediums can be opened and closed. The command line tools allow you to clone drives and create, delete, or modify existing ones. Conversion support is enabled, meaning you can convert VMDK- and VHD-supported virtualization extensions to VirtualBox VDI types.

 

On a Linux machine, all of the virtual machine configuration files and hard disk files are stored under a hidden directory within your user profile. For instance, under my user profile of /home/maxhetrick/.VirtualBox, the files can be found. All of the configuration files are stored under the Machines directory, and all of the hard disks are stored under the HardDisks directory. When running VirtualBox command-line tools, you can refer to these files.

 

Although there are several command-line tools, the main command-line tool that's used to work with VirtualBox is VBoxManage. If you simply type VBoxManage at the command line, you should get the complete list of arguments it uses. To get a list of all the virtual machines on the system, you can type the following.

 

# VBoxManage list vms

 

"WinXP" {feb5329d-fbce-494b-85c8-20e2b6ed17ec}

"Ubuntu-9.10" {1328b5d5-412a-4147-ac20-247d974793e3}

 

You'll notice the identifier string next to the name of the virtual machines. This is the Universally Unique Identifier (UUID) that VirtualBox uses internally to reference the virtual machines. Either the UUID or the virtual machine name can be used in commands, as long as machine names are unique.

 

All command list arguments can be isolated to show only the help related to that particular argument if you'd like to narrow down the output. For instance, to see just the help with the createvm argument, type only what you want to view.

 

# VBoxManage createvm

 

The one feature that is missing in the GUI, which can be accessed from the command-line interface (CLI), is the performance metrics data of virtual machines. The VBoxManage metrics command accesses all the performance information of machines. To gather a five-second increment of statistics for a running virtual machine, use the period switch.

 

# VBoxManage metrics collect --period 5 Ubuntu-9.10

Time stamp Object Metric Value

------------ ---------- -------------------- --------------------

20:57:30.205 Ubuntu-9.10 CPU/Load/User 1.60%

20:57:30.205 Ubuntu-9.10 CPU/Load/User:avg 1.60%

20:57:30.205 Ubuntu-9.10 CPU/Load/User:min 1.60%

20:57:30.205 Ubuntu-9.10 CPU/Load/User:max 1.60%

20:57:30.205 Ubuntu-9.10 CPU/Load/Kernel 3.51%

20:57:30.205 Ubuntu-9.10 CPU/Load/Kernel:avg 3.51%

20:57:30.205 Ubuntu-9.10 CPU/Load/Kernel:min 3.51%

20:57:30.205 Ubuntu-9.10 CPU/Load/Kernel:max 3.51%

20:57:30.205 Ubuntu-9.10 RAM/Usage/Used 259352 kB

20:57:30.205 Ubuntu-9.10 RAM/Usage/Used:avg 259352 kB

20:57:30.205 Ubuntu-9.10 RAM/Usage/Used:min 259352 kB

20:57:30.205 Ubuntu-9.10 RAM/Usage/Used:max 259352 kB

------------ ---------- -------------------- --------------------

 

There are many more options than this one to gather data, so just refer to the help output of the commands to walk you through all of the arguments and switches.

Virtualization Made Easy

Although I'm running VirtualBox so far only as a desktop system, I see no reason why this product isn't robust enough to run as a virtual machine server. At the desktop level, VirtualBox provides a very clean, smooth, and easy-to-use GUI for the users who just want virtualization to be made easy for them. This is probably its greatest strength. For you hardcore option-oriented users, VirtualBox's command-line interface is complete, allowing you to do everything the GUI can, plus more.

BLOG COMMENTS POWERED BY DISQUS