How To: From VMWare To VirtualBox
VirtualBox is a free, OpenSource alternative to VMWare. An alternative seriously worth a look! It is much more convenient than QEmu (Another OpenSource Virtualizer) for several reasons: It has an intuitive Graphical Interface, it can handle USB devices simply, using it you can switch between ISO disc images quickly and the "speed up" tool has the easiest install.
Written by Luca De Marini
In this Guide I assume you know about Virtualizers and are actually using VMWare Player. So, why is VirtualBox better than VMWare Player for you?
- It is Free Software (Open Source)
- It can create and handle any Virtual Machine / Virtual Disc with no problem. You can't do that with VMWare Player. You'd either have to download and install VMWare Server (free, but not open source) to create a new Virtual Machine and edit it with limited options or you'd have to create a new Virtual Machine following a weak how-to from another website.
- Using it, you'll have total control over your USB devices, ISO images, sound and so on, all things you cannot control using VMWare Player (You'd have to edit your Virtual Machine manually)
- You can install the speed up tools very easily, without having to find them somewhere else. For example, you don't need to download the free VMWare Workstation Trial to extract from its archive the ISO images of the VMWare tools. The entire process will be quick, fast and painless.
And Why would you prefer VMWare Player over VirtualBox?
Only one reason for now: VMWare Player offers more Network modes. Naturally, it is VMWare in general that supports these modes. In fact, to activate them, you'd have to manually edit your Virtual Machine in any case! So, if you can avoid using special Network features, switch to VirtualBox NOW!
So you like Virtual Box and want to switch to this wonderful Open Source software, but you already have a VMWare Virtual Machine you often use? Don’t worry, it is tricky but you can convert a VMWare virtual machine into one that will work in Virtual Box. Why is this conversion absolutely convenient for you? Read on about How to Install Virtual Box and why you should do it.
Installing Virtual Box
Download Virtual Box for your Linux System here: http://www.virtualbox.org/wiki/Downloads
Let's see the steps we need to install Virtual Box on Ubuntu Feisty/Edgy
VirtualBox requires the following dependancies: libxalan110 and libxerces27
When you install the .Deb package, remember to expand the terminal window to see the messages inside it. You may receive a warning about the User Groups. We will cover that in the next step.
You may need to set some permissions before you can run VirtualBox. To do this, go to System --> Administration --> Users and Groups
This will open the Users and Groups settings window, after you enter the system password.
Select your username, then click on the Manage Groups button. A new window will appear:
In this window, press the Add Group button and, from the list, add the vboxusers Group. Click OK, restart the PC and you are finished setting permissions.
Running Virtual Box
Now that VirtualBox is installed and fixed, you can find it in the menu: Applications—>System Tools—>InnoTek VirtualBox. VirtualBox will run and you'll see the following screen:
Converting your existing .vmdk Virtual Disc Image To a .vdi File
Now we need to convert your existing VMWare disc image into a format readable by VirtualBox. Don't worry, you won't lose any data, but just in case, you can always create a backup copy of your virtual disk before we start!
First, download and install qemu from Synaptic or the terminal.
Now open a terminal and 'cd' into the folder where you’ve got your .vmdk virtual disc image and enter:
qemu-img convert harddrive-name.vmdk raw-file.bin
Naturally, you’ll have to change harddrive-name with the name of your .vmdk file and raw-file with the name of the new converted file you want to create. After a few minutes, the conversion will be completed. Now we’ve got a raw hard disk image and we want to transform it into a .vdi file!
We need a new application, vditool. You’ll find it here: http://www.virtualbox.org/download/testcase/vditool.
Download it into the same directory where you’ve got your new raw .bin disc image file.
NOTE: Downloading that vditool file is not the simplest thing in the world. If you try and open it with Firefox, for example, a strange page with weird code in it will appear. To save this vditool file, right click on the link and choose to save the file. You can also tell a download manager to download this file for you. I suggest you use the download manager: Aria. It is in the Ubuntu repositories.
Now that we’ve got vditool, we need to make it executable. Right click on the file, open its properties and select the “Executable” permission option. In Gnome/Nautilus, go into the 'Permissions' tab and activate the “Allow executing file as a program”.
At this point, we need the terminal again. From the same directory where you stored vditool and the .bin raw file, run this command from the console:
LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool DD new-file.vdi old-file.bin
Replace new-file.vdi with the name of the file you want vditool to output. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, you need to replace old-file.bin with the correct filename.
NOTE: If you wish, remember that you can run vditool for other tasks too. For example, we'll now run it to optimize the filesize of the .vdi image file. To get a list of all commands, you’ve just got to execute vditool without any other option.
Let's optimize the file size of the newly converted .vdi file. For now, let’s call it new-file.vdi. From the directory where you have the file, run this command in the terminal:
LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool SHRINK new-file.vdi
Now we’re all set up.
Creating a new VirtualMachine
Just click on the "New" button on the upper left side of the window:
Now you can follow the Wizard.
Here are the guided steps:
Click on Next. In this Screen you'll see the VirtualMachine name and OS Type. Assign to Name whatever you like but remember to correctly set the OS Type, for example, Windows XP (Windows runs almost at the native machine speed into a VirtualBox Virtual Machine, you have to see it to believe it!).
Now assign the amount of RAM memory to the Virtual Machine (below). I recommend using no more than the half of your real physical memory.
Here's the Hard Disk selection page.
If you didn't need to switch from VMWare to VirtualBox, that is, if you haven't got a hard disk image to use, create a new one. Otherwise (And that's the purpose of this How-To), choose the Virtual Disc Image we just converted, that is the .vdi file we obtained after the conversion.
You'll see the summary of your new Virtual Machine. Click on Finish and there you are!
Running and setting up your new Virtual Machine
The Machine has been created but we need to set it up a bit. Some very quick and simple steps:
Click on the Settings button in the upper left part of the VirtualBox window:
You'll see the settings window. Some important Settings you might want to set are:
- Under the advanced tab, there's the booting order of your Virtual Machine, the same settings you'd have in a normal BIOS. I suggest you to set it to CD/DVD Rom and then Hard Disk, so that it will be able to boot any bootable CD you may insert into the drive.
- Under the CD/DVD-Rom option you'll have to set: Mount CD/DVD Drive. You can choose either to have Virtual Box handle your real CD/DVD Device or mount any ISO image! Isn't that great?
- Enable sound and set up your Network connection. I suggest you to set it on NAT.
- Under the USB option you can choose whether to enable or disable USB handling by VirtualBox. Remember that if you enable it, while VirtualBox will be running, it will steal any connected USB devices from the real machine.
Now we're ready. Choose your Virtual Machine from the list and click on the Start button. If everything is okay, the machine will run, even if it will have to be set up some more inside the OS you’re using. For example, WIndows will have a lot of problems in this part since some of its Virtualized hardware has changed.
When I started my old disc image converted into a new compressed .vdi file inside a new Virtual Machine created with VirtualBox, Windows XP refused to start. I had to insert in the CD-Rom of my original Windows XP CD, boot from CD and restore the windows installation! Windows, this way, reconfigured and installed each new virtual peripheral so that at reboot everything was okay and all my programs where left installed where they were.
The final Step is to install the VirtualBox Additions to have the fastest performance possible into your virtualized OS. Find the instructions for this step in the Virtual Box User Manual here: http://www.virtualbox.org/download/UserManual.pdf
Check Chapter 4 in the manual.
Conclusions
VirtualBox is a wonderful virtualization Tool, but you'll probably want some more information about it, since this is not intended as a complete user guide. Read the entire Manual (That I linked in the above Chapter) and also have a look at this page in the VirtualBox Website for interesting information about networking, sharing files between guest and host OS'es and much more: http://www.virtualbox.org/wiki/User_HOWTOS
Homepage: http://www.virtualbox.org