Wednesday Feb 10, 2010

LinuxQuestions.org ran a poll to find "Products of the Year" in various categories.

A pretty good result in the Virtualization section for VirtualBox - the People's Hypervisor ;-)

Thanks to all who voted. 

 -FB

Tuesday Feb 09, 2010

There are a growing number of people asking the question: how do you move a VMware virtual machine to VirtualBox. So it is about time the Fat Bloke rolled up his sleeves and showed us how. (BTW you can click on screenshots below to magnify)

People typically want to do this because they have spent time installing a guest OS together with a software stack and they don't really want to go thru all this again. But moving a vm from one virtualization platform to another is analogous in the real world to unplugging a hard drive(s) from one computer and plugging it into a different manufacturer's computer. You may find that the guest operating system gets upset when it boots up and sees virtual hardware which is different than it was expecting. Different guest operating systems react differently to this situation (Linux is typically more accommodating than Windows in this respect).  In fact some guest operating systems get so upset, they may BSOD (Blue Screen of Death) on you.

Secondly, some of the software that you have installed above the OS, such as VMware Tools, may also be relying on specific virtual hardware.

So the Fat Bloke's First Rule of VM Migration is: Don't, if you can help it. If you can create a new vm from scratch on the new virtualization platform, you probably should. That way the guest OS installs the right drivers for your particular virtual hardware, and you are not left with orphaned software which needs a specific virtualization layer.

That said, there are still going to be people looking to avoid a complete reinstallation and willing to live dangerously, so let's discuss what is possible. Note that because different guests behave so differently we're going to focus on one guest OS in this blog: Oracle Enterprise Linux, and we'll move it from VMware Workstation 7 to VirtualBox 3.1. Here is our start state, the vm running in VMware Workstation 7 on Windows 7:

Starting Position

Step 1 - Preparing to Migrate 

It's a good idea to take a copy of the vm that we're trying to migrate just in case you make a mess of things. With VMware Workstation you can clone a vm to do this or copy the machine in some other way such as copying files.

Clone

To prepare for migration we're going to remove virtualization platform-specific components:

  1. Remove VMware tools
  2. Reset the Display and Input device  configuration
  3. Remove incompatible devices 

The Fat Bloke's Second Rule of VM Migration is that it is easier to unpick platform-specific software on the native virtualization platform. So let's start up the vm under VMware to prepare for migration

Removing VMware Tools 

This is easy enough: 

vmware-uninstall-tools.pl

and you should see something like this:

uninstall tools

Resetting the Display Device and Input Devices

When Oracle Linux was first installed the display was set as a VMware display adaptor and input devices as a VMware keyboard and mouse. By the time we're finished this won't be the case, so let's prepare for that by moving aside the the OEL X.org conf file like this:

mv /etc/X11/xorg.conf /etc/X11/xorg.conf.vmware

This file will get recreated later when we run on the VirtualBox platform.

Now let's shutdown the guest. 

Shutdown

Remove Incompatible Devices

The VMware soundcard device is different from the one that VirtualBox exposes so let's remove this device from the vm configuration in the VMware Settings dialog:

Remove Soundcard

Step 2 - Exporting the Virtual Machine

A Virtual Machine consists of :

  • configuration information (in VMware a .vmx file)
  • virtual hard drive(s) which the guest is installed on. (in VMware, typically .vmdk files)

An emerging standard for encapsulating this information to allow vm's to be transported more easily is the OVF or Open Virtualization Format. So in theory you should be able to Export this vm from VMware Workstation and Import into VirtualBox. Sadly, the VMware conversion wizard (File...Import or Export...) doesn't support Oracle Enterprise Linux as a guest:

can't export

But there is a command line ovftool that can be downloaded from VMware's site.

So in a Windows command.exe window you can run:

cd C:\Users\fatbloke\Documents\Virtual Machines\Clone of Oracle Enterprise Linux 
"\Program Files\VMware\VMware OVF Tool"\ovftool.exe "Clone of Oracle Enterprise Linux.vmx" OEL.ovf 

And eventually you end up with 3 files:

  1. OEL.ovf - configuration information
  2. OEL-disk1 - compressed disk format file
  3. OEL.mf -  digital signatures (SHA1) of the other files.

 We can now move these to the destination system for import by VirtualBox.

Step 3 - Importing into VirtualBox 

You can import an ovf file into VirtualBox from the graphical user interface or the command-line.

Import OVF

Importing this takes a while as the compressed disk is converted to a usable format, but your should end up with a new entry in your vm list in VirtualBox like this:

Imported vm

 Now the moment of truth, Start it up...and we should see Oracle Enterprise Linux boot up under VirtualBox

OEL under VirtualBox

 Step 4 - Install the VirtualBox Guest Additions

 Finally don't forget to install the VirtualBox Guest Additions which is the mirror image operation to removing the VMware Tools.

Install Guest Additions

Once you have mounted the Guest Additions iso image you can run install them from the mounted directory using the command:

sh VBoxLinuxAdditions-x86.run 

 Like this:

Install GA

And after a restart of the guest you are all set to go.

Migration is complete! 

Epilogue (Advanced users only)

There is an alternative to step 2 and 3 above for people who know what they are doing.

After performing Step 1 you could simply take the VMware disk image (.vmdk)  and plug this into a manually configured VirtualBox vm. This effectively relies on the user to create an appropriately similar vm instead of relying on the ovf export and import (Steps 2 and 3 above) process. Note that the default disk controller used by VMware is an LSI SCSI controller, so when manually creating a VirtualBox vm you need to configure it appropriately. 

Add SCSI Controller

You still need Step 4 for optimal performance and ease of use. And don't forget the tip about Speeding up Linux Guests too.

Good Luck!

- FB 

Friday Jan 15, 2010

In case you haven't noticed, a lot of Fat Bloke's Blogs are reminders to self ;-) Here's another one... 

If you have created a 64-bit Windows 7 virtual machine, you may think it is awfully quiet. This is because the 64-bit version of Windows 7 does not ship with drivers for the audio device (AC 97) which VirtualBox presents to the guest OS.

If you want audio you have to go get the drivers and install them yourself. I got mine from Realtek site. 

Once you have installed them, and rebooted, you should get audio just fine.

- FB 

Wednesday Jan 06, 2010

Question: what do the following have in common?

  1. Intel Nehalem Processor 
  2. Microsoft Windows 7 
  3. Cisco's Unified Computing System (UCS)
  4. Amazon Web Services 
  5. Apple iPhone OS
  6. Sun VirtualBox

Answer: They were all winners of InfoWorld's 2010 Technology of the Year awards.

-FB 

Monday Jan 04, 2010

With the clock ticking over to a new decade, now would seem to be a good time for a quick blog on timer interrupts in guests and how you can speed up your guests, while also lightening the load on your host, with the judicious use of a bit of guest configuration.

All operating systems make use of a system clock which ticks at a particular frequency. Common Linux distributions use kernels which drive the clock at 100Hz, 250Hz or 1000Hz. You can find out what your Linux kernel is configured for using this command:

grep CONFIG_HZ /boot/config-<kernel>

where kernel is the version of Linux you're running. The result of this command on my Oracle Enterprise Linux installation looks like this:

[root@localhost grub]# grep CONFIG_HZ /boot/config-2.6.18-164.el5
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
CONFIG_HZ_1000=y
CONFIG_HZ=1000

...which tells me that my kernel is configured to use a 1000Hz clock tick.

In a virtualized environment this means that there will be lots of context switches as the host schedules the guest to deal with clock ticks which don't do very much.  And this will become most visible by seeing a relatively high host cpu usage even when the guest is idle. (Note that the exact behaviour also depends on the host system. For example, the same OEL vm runs comfortably on my Mac host, but my Windows host gets very busy running it.)

If you see an idle Linux guest which is configured for a 1000Hz clock using up lots of host cpu cycles, you may want to reduce the clock frequency using the boot time parameter "divider=10". You can do this by adding the parameter manually as the grub boot loader starts, or by editing the grub configuration file as follows:

  1. Edit /boot/grub/grub.conf
  2. Duplicate the existing Title section, and rename it (this means you can choose at boot time which config to use)
  3. Add the "divider=10" parameter as follows:
 kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet divider=10

Here is what my complete grub.conf looks like now:

Grub.conf

This results in fewer context switches, a lighter host load (as measured by Window Task Manager) and faster guest execution. For example, the speed to boot my OEL vm (on a Windows 7 host) dropped from 115 seconds to 80 seconds which, according to my calculations, is a 30% increase in performance. Not bad for a simple bit of configuration ;-)

-FB 

Thursday Dec 24, 2009

The FatBloke loves movies at Christmas. So to add to the festive cheer, he has produced a couple of his own based on some of the new features of VirtualBox 3.1. This special, bumper Christmas double-bill features movies about Teleportation (is this how Santa gets about?) and Snapshots. You can watch in HD and full screen mode, but no 3D yet ;-)

Merry Christmas

-FB 

Thursday Dec 17, 2009

Some time ago we talked about virtual appliances as an easier way of distributing operating systems and even complete software stacks. 

Well, for the first time there is now a Solaris 10 10/09 (aka u8) ovf available.

Just:

  • Download the appliance
  • Unzip (if not done automatically for you)
  • Then in VirtualBox, choose the File...Import Appliance menu item
  • Navigate to the ovf file and import

And after clicking Import you will get a sys-unconfig'ed Solaris 10.

On first boot you do the config and hey presto, you have Solaris 10 running in a vm.

Solaris 10

For best results, don't forget to then install the VirtualBox Guest Additions by choosing Devices...Install Guest Additions from the VirtualBox menu.

-FB 

VirtualBox 3.1.2 has just been released.

It is a bug fix release and available to download from the Usual Places.

For a fuller list of fixes check out the ChangeLog

-FB 

Tuesday Dec 08, 2009

(A little late, I know but last week was kinda busy...)

Even though the version number only moved from 3.0 to 3.1, last week's VirtualBox release was a significant one with lots of very cool, but also very useful, new features:

Teleportation

Teleportation is Live Migration++. It is the ability to move currently running virtual machines across different physical machines with no interruption as you do it. And whereas with Live Migration/vMotion the virtualization platforms have to be near identical to work, teleportation is powerful enough to cope with:

  • different host operating systems, such as Windows to Linux
  • different classes of computer, such as server to laptop; and even
  • different CPU architectures, such as Intel to AMD (yes, the manual has a bug here) 

This means greater choice of platforms for customers, and interesting solution opportunities for our partners.

VirtualBox exposes the teleportation primitives via APIs which higher level logic can call to direct the teleportation process. For people looking to exercise these APIs you can use the VBoxManage command line tool, such as:

VBoxManage modifyvm <vm name> --teleporter on --teleporterport 1234 \ 
  --teleporterpassword password --teleporteraddress <dns name/ip address>

VBoxManage controlvm <vm name> teleport --port 1234 \
 --host <dns name/ip address> --password password

(I promise to do a dedicated posting on this real soon now.)

Snapshots 2.0 

Taking snapshots is a great way of saving the state of a virtual machine at various points in its lifecycle. Until this release, VirtualBox only allowed you to revert to the last snapshot state but with 3.1, the Snapshot feature in VirtualBox has been given an overhaul and you can now:

  • Take any number of snapshots of a vm;
  • Revert to any arbitrary snapshot state;
  • Take further snapshots from that point.

This means that you can create sophisticated multi-generational snapshot trees, ideal for testing your software on previous generations of operating systems or Service Packs for example. Or put another way, you can go backward or forward in time to exactly the state of the snapshot that interests you.

For example, here is a snapshot tree where we can revert to whichever Windows XP Service Pack and IE version we need to:

Performance Improvements

This time there are improvements in:

  • execution speed - paging optimizations which in our tests produced a 30% increase when compiling the Linux kernel;
  • network performance - newly introduced support for guests with VirtIO drivers;
  • display performance - new 2D video acceleration for Windows guests which uses the host video acceleration hardware.

Dynamic Network Configuration

Say you're using a Host-only network setup with a couple of vm's talking to each other, but then you need to do a Software Update of one of the vm's. This requires that you need Internet access. You can now switch to a networking mode, say NAT, on the fly without needing to close down the vm.

Multiple concurrent CD/DVDs

Storage handling changed in 3.1 with the most obvious benefit now being that you can have multiple CDs attached to a guest. This meant quite some changes in the GUI and command line.

Support for Parallels disks

For people defecting to VirtualBox but wanting to bring all their worldly goods with them, we now support Parallels .hdd virtual disk format files.

Solaris Host USB

Using a Solaris notebook or PC? Then we're now using the later Nevada (124+) build USB features.

EFI Firmware

Some operating systems (e.g. Fedora) are moving to using the Extensible Firmware Interface (EFI) in place of a more traditional BIOS firmware. VirtualBox 3.1 introduces experimental support for this.

These are just some of the headline features. You can get a fuller list from the ChangeLog, but all-in-all a pretty good crop of features and consistent with the mission to make VirtualBox the best hypervisor out there.

-FB 

Friday Nov 27, 2009

A little something that had me scratching my head for a while and may save others some time....

When you try to close the window of a VirtualBox virtual machine session, a dialog pops up thus:

In the past, the "Send the Shutdown signal" has sent a Powerdown message which caused Windows XP vm's to gracefully shutdown.

But on Windows 7 vm's, the default Power Options when installed on a laptop are undefined:

So to get the previous behaviour you need to change the Power Options as follows:

Hope this saves someone some time.

-FB

Tuesday Nov 17, 2009

In the spirit of, "Hey we fixed a bunch of bugs, why hold on to them?" VirtualBox 3.0.12 was released today.

You could read about the fixes or just go get the new version

-FB 

Friday Oct 30, 2009

VirtualBox 3.0.10 just released!

Among other things this maintenance release:

  • fixes a memory leak on Mac hosts;
  • solves a few SMP issues; 
  • detects other active hypervisors (e.g. XP-mode); and
  • fixes a bug with Solaris host DVD support;
  • check the full list

It is available to download from the Usual Places .

-FB 

Tuesday Oct 06, 2009

VirtualBox 3.0.8 was released today. This aims to increase stability and provides support for very large disks too.

The 3.0.8 maintenance release was made available to download from the Usual Places earlier today.

For a fuller list of fixes check out the ChangeLog

-FB 

Wednesday Sep 23, 2009

The hard-drive(s) of your virtual machines are simply files which are stored typically on the host's filesystem. On my Mac they're in 

~/Library/VirtualBox/HardDisks/

VirtualBox understands several disk formats including:

  • .vdi or "Virtual Disk Image", the native format for VirtualBox
  • .vmdk - VMware's format
  • .vhd - Microsoft's format

This means that if you have an existing hard drive from another virtualization platform, you can plug it into a VirtualBox vm by telling the system about it using the Virtual Media Manager...

Sun VirtualBox

Virtual Media Manager

 And then configuring it in the vm's Storage configuration dialog (or via the command line):

Android - Storage

Given that VirtualBox not only understands, but can also create, these different formats, one obvious question is "what is the difference?" or "which one is best?" 

One of the VirtualBox team (thanks Klaus) explained:

"The major difference is that VDI uses relatively large blocks (1MB) when growing an image, and thus has less overhead for block pointers etc. but isn't ultimately space efficient in the sense that if a single byte is non-zero in such a 1MB block the entire space is used.
VMDK in contrast uses 64K blocks, and thus has more management overhead and generally a bit less disk space consumption
What offsets this is that VDI is more efficient when it comes to snapshots."

So now you know!

- FB 

Thursday Sep 10, 2009

VirtualBox marches on with the new version 3.0.6 maintenance release focused on performance and stability. If you use AMD, then this is Christmas morning ;-) And a few Snow Leopard wrinkles were ironed out too. 

Version 3.0.6 also has a few changes in support of the embryonic VirtualBox Web Console project. 

The 3.0.6 maintenance release was made available to download from the Usual Places earlier today.

For a fuller list of fixes check out the ChangeLog

-FB 

This blog copyright 2010 by TheFatBloke