Switching_From_VMWare_To_VirtualBox:_.vmdk_To_.vdi_Using_Qemu_+_VdiTool

Differences between revisions 1 and 18 (spanning 17 versions)
Revision 1 as of 2007-05-09 10:20:11
Size: 9211
Editor: stat-85-88-200-21
Comment:
Revision 18 as of 2008-03-03 00:26:43
Size: 12543
Editor: 5acd417f
Comment: fix self-inflicted edit conflict (saved two times in quick succession)
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
        * The speed up tool is VERY simple to install, the simplest around (Qemu's one is KQemu and it is really hard to have it working, believe me)         * The speed up tool is VERY simple to install, the simplest around. (Qemu's one is KQemu and it is really hard to get working. Believe me.)
Line 14: Line 14:
In this Guide I assume you know about Virtualizers and are actually using VMware Player, a free tool but not an OpenSource Software. So, why is VirtualBox better than VMWare Player for you? In this Guide I assume you know about Virtualizers and are actually using VMware Player, which is a free tool but not OpenSource Software. So, why is VirtualBox better than VMWare Player for you?
Line 16: Line 16:
        * It is Free Software (Open Source)
        * It can create, handle any Virtual Machine / Virtual Disc with no problem. You can't do it with VMWare Player. You'd have either to download and install VMWare Server too (This is a free download like VMWare Player but it's allways proprietary software) to create a new Virtual Machine and edit it with limited options or you'd have to create a new Virtual Machine following some weird Online WebPages process
        * 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. Foe 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 and fast and painless.
      
And Why would you prefer VMWare Player over VirtualBox?
        * It is Free and Open Source Software
        * It can create and handle any Virtual Machine or Virtual Disc with no problem. You can't do this with VMWare Player. You'd have to either download and install VMWare Server (also a free but proprietary software) to create a new Virtual Machine and edit it with limited options, or create a new Virtual Machine following some weird process you find somewhere online.
        * You 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. The entire process will be quick and fast and painless. With VMWare, you'd need to download the free VMWare Workstation Trial to extract the ISO images of the VMWare tools from its archive.
Line 23: Line 21:
        * Only one reason for now: VMWare Player offers more Network modes. Naturally, it is VMWare in general that supports this 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! :) And Why would you prefer VMWare Player over VirtualBox?
Line 25: Line 23:
So you like Virtual Box and want to switch to this wonderfull Open Source software but you allready 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 on Virtual Box. Why this conversion is absolutelly convenient for you? Read my next post about How to Install Virtual Box and why you should do it.         * 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 anyway! 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 on Virtual Box. How convenient is this conversion? Read my next post about How to Install Virtual Box and why you should do it.
Line 36: Line 36:
        * Double click on the VirtualBox downloaded .deb package and install it.
        * You now may need to set some permissions before you can run VirtualBox. To do this, open a Terminal and run:
        * Double click on the VirtualBox downloaded .deb package and install it. Remember to expand the Terminal window, otherwise you won't be able to see the messages inside it. You'll need to agree to the license and click OK on the message warning you about the User Groups problems we'll fix in the next step
Line 39: Line 38:
    '''sudo nautilus''' attachment:vboxterminal.png
Line 41: Line 40:
To open the file browser in administrator mode. Play cautions! You could even delete system files from this Super Nautilus, so, it IS dangerous.
        * With the new Super Nautilus opened, move into the /dev/ folder and look for the vboxdrv folder.
        * Right click over this folder, we're going to set its permissions. Choose properties from the opened menù.
        * You now may need to set some permissions before you can run VirtualBox. To do this, System --> Administration --> Users and Groups

This will open the Users and Groups settings window, after you enter the system password.

attachment:vboxpermission2.jpg

Select your username, then click on the Manage Groups button. A new window will appear:

attachment:vboxpermission3.jpg

In this window select the vboxusers group from the list, and click on the "properties" button. In the following vboxusers properties window, add your username to the "Group Members" by selecting the tick-box next to your username. Click OK, exit all the menus and restart the PC. You are now a member of the vboxusers group.
Line 47: Line 54:
Now VirtualBox is installed, find it into the menù: Applications—>System Tools—>InnoTek VirtualBox. VirtualBox will run and you'll see the following screen: Now VirtualBox is installed and fixed, find it into the menù: Applications—>System Tools—>InnoTek VirtualBox. VirtualBox will run and you'll see the following screen:
Line 53: Line 60:
Now we need to convert your existing VMWare disc image into a format readable by VirtualBox. DOn't worry, you won't loose any data but, just in case, you can always create a backup copy of your VirtualDisk before we start! 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 VirtualDisk before we start!
Line 65: Line 72:
        * We need a new application. You’ll find it here: http://www.virtualbox.org/download/testcase/vditool Download it into the same dir where you’ve got your new raw .bin disc image file. The name of this app is vditool.         * We need a new application called "vditool". You’ll find it here: http://www.virtualbox.org/download/testcase/vditool Download it into the same dir where you’ve got your new raw .bin disc image file.  A simple way to download this app is from the command line, like so:
    {{{wget http://www.virtualbox.org/download/testcase/vditool}}}
Line 67: Line 75:
'''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 the download manager: Aria. It is into Ubuntu repositoryes.'' '''NOTE:''' ''To download vditool using a web browser, 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 using the download manager "Aria", which is in the Ubuntu repositories.''
Line 77: Line 85:
Where new-file.vdi is the file that will be outputted by vditool and must be the first to appear in the command. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, change this invented names with real ones. Where new-file.vdi is the file that will be outputted by vditool and must be the first to appear in the command. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, change these invented names for real ones.
Line 85: Line 93:
        * Now we’re all setted up.         * Now we’re all set up.

'''Notes for AMD64 users.'''
The vditool executable above only works on 32 bit systems. If you have a 64bit system then use the "vditool" image and library path from your existing VirtualBox installation. The following commands suit an AMD64 system running Ubuntu 7.10:
    '''LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool DD new-file.vdi old-file.bin'''
    '''LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool SHRINK new-file.vdi'''
(These commands should actually work on both 32bit and 64bit systems).
== Multiple vmdk files to single vdi ==

The problem is simple. Very often, maybe due to Fat32 partition limits, people split their VMWare disc images into multiple files. So how do you convert multiple .vmdk files into a single .vdi file for Virtual Box?

What you have to do is:

        * Download and install VMWare Server for your platform. It is freeware but proprietary software; it is opensourced but you’ll need to subscribe for a license to use it. We’ll just use this to convert multiple vmdk images into a single one. You can find VMWare Server here.

        * Run a terminal, move in the dir where you store your multiple vmdk disc images and run:

    '''vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk'''

And that’s all! The multiple vmdk images will be converted into one single vmdk image file. At that point you’ll be able to use this guide as normal to convert the newly obtained vmdk disc image into a single .vdi file!
Line 93: Line 120:
Now you can follow the Wizard.  Now you can follow the Wizard.
Line 103: Line 130:
        * Now assign the amount of RAM memory to the Virtual Machine. I recommend not more than the half of your real physical memory.          * Now assign the amount of RAM memory to the Virtual Machine. I recommend not more than the half of your real physical memory.
Line 111: Line 138:
        * You'll see the summary of your new Virtual Machine. Click on Finish and there you are.          * You'll see the summary of your new Virtual Machine. Click on Finish and there you are.
Line 117: Line 144:
        *         * Click on the Settings button in the upper left part of the VirtualBox window:
Line 119: Line 146:
If everything is okay, the machine will run, even if it will have to be setted up again a bit from inside the OS you’re using. FOr example, WIndows has got a lot of problems in this part.         attachment:vboxscreen7.png
Line 121: Line 148:
When I started my old disc image converted into a new compressed .vdi file inside a new Virtual Machine created with VBox, WinXP refused to start. I had to insert in the CD-Rom my original WinXP Cd to 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.         * 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 a little your Network connection. I suggest you to set it on NAT.
        ** Under the USB option you can choose wheter to enable or disable USB handling by VirtualBox. Remember that if you enable it, while VirtualBox will be running, it will steal any plugged-in USB device from the real Machine!
Line 123: Line 154:
I sincerely hope this helped a lot of people out there. It is allmost impossible to find a way to use vditool in Google for now. No matter how much you google, I spent the all day trying to find something. Thanks to the guys from the VBox IRC Channel for helping me out, I wasn’t going to get out from this problem alone. And a lot of people in Ubuntu Forum where in my same conditions, so…. Enjoy your migration to Virtual Box!         attachment:vboxscreen8.png

        * 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 a little set up will be required from inside the OS you’re using. For example, Windows will have a lot of problems 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 VBox, WinXP refused to start. I had to insert in the CD-Rom of my original WinXP CD, boot from CD and restore the windows installation! Windows reconfigured and installed each new virtual peripheral so that at reboot everything was okay and all my programs were left installed in their original locations.

        * The final step is to install "VirtualBox Additions" to have the fastest possible performance from your virtualized OS. Find the instructions for this step in Chapter 4 of the Virtual Box User Manual: http://www.virtualbox.org/download/UserManual.pdf

== Conclusions ==

VirtualBox is a wonderful Virtualization Tool, but you'll probably want some more information about it, since this is not intended as a user guide. Read the entire manual (linked to in the above Chapter) and also have a look at this page in the VirtualBox Website for interesting information about Network, Sharing Files between guest and host OSes and much more: http://www.virtualbox.org/wiki/User_HOWTOS

Switching From VMWare To VirtualBox: .vmdk To .vdi Using Qemu + VdiTool

attachment:vmwaretovirtualbox.png

Introduction

VirtualBox is a free and OpenSource alternative to VMWare. A reasonable alternative! 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
  • The speed up tool is VERY simple to install, the simplest around. (Qemu's one is KQemu and it is really hard to get working. Believe me.)

In this Guide I assume you know about Virtualizers and are actually using VMware Player, which is a free tool but not OpenSource Software. So, why is VirtualBox better than VMWare Player for you?

  • It is Free and Open Source Software
  • It can create and handle any Virtual Machine or Virtual Disc with no problem. You can't do this with VMWare Player. You'd have to either download and install VMWare Server (also a free but proprietary software) to create a new Virtual Machine and edit it with limited options, or create a new Virtual Machine following some weird process you find somewhere online.
  • You 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. The entire process will be quick and fast and painless. With VMWare, you'd need to download the free VMWare Workstation Trial to extract the ISO images of the VMWare tools from its archive.

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 anyway! So, if you can avoid using special Network features, switch to VirtualBox NOW! Smile :)

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 on Virtual Box. How convenient is this conversion? Read my next post 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

  • You need some packages to install VirtualBox. Open a Terminal and type:

  • sudo apt-get install libxalan110 libxerces27

    • Double click on the VirtualBox downloaded .deb package and install it. Remember to expand the Terminal window, otherwise you won't be able to see the messages inside it. You'll need to agree to the license and click OK on the message warning you about the User Groups problems we'll fix in the next step

attachment:vboxterminal.png

  • You now may need to set some permissions before you can run VirtualBox. To do this, System --> Administration --> Users and Groups

This will open the Users and Groups settings window, after you enter the system password.

attachment:vboxpermission2.jpg

Select your username, then click on the Manage Groups button. A new window will appear:

attachment:vboxpermission3.jpg

In this window select the vboxusers group from the list, and click on the "properties" button. In the following vboxusers properties window, add your username to the "Group Members" by selecting the tick-box next to your username. Click OK, exit all the menus and restart the PC. You are now a member of the vboxusers group.

Running Virtual Box

Now VirtualBox is installed and fixed, find it into the menù: Applications—>System Tools—>InnoTek VirtualBox. VirtualBox will run and you'll see the following screen:

attachment:vboxscreen1.png

Converting you 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 VirtualDisk before we start!

  • First of all, download qemu, you can do it using Synaptic or simply opening a Console and executing:
  • sudo apt-get install qemu

    • Now open a terminal and go into the folder where you’ve got your .vmdk virtual disc image and type this:

    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 called "vditool". You’ll find it here: http://www.virtualbox.org/download/testcase/vditool Download it into the same dir where you’ve got your new raw .bin disc image file. A simple way to download this app is from the command line, like so:

  • wget http://www.virtualbox.org/download/testcase/vditool

NOTE: To download vditool using a web browser, 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 using the download manager "Aria", which 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 set the “Executable” permission option. In Gnome, go into the Permission tag and activate the “Let this program be executed” or something like that option (Remember, my Ubuntu is Italian, dunno what’s your exact translation).

attachment:executable.png

  • At that point, we’ll need the terminal again, from the same dir where you’ve stored vditool and the .bin raw file. Run this from console into the interested dir:
  • LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool DD new-file.vdi old-file.bin

Where new-file.vdi is the file that will be outputted by vditool and must be the first to appear in the command. The second filename, old-file.bin, is the name of the raw disc image we converted the .vmdk image to. Naturally, change these invented names for real ones.

NOTE: If you wish, remember that you can run vditool for other tasks too. Now we’ll run it to optimize the filesize of the .vdi image file, for example. For 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 .dvi file, let’s call it new-file.dvi and from the terminal in the dir where you’ve got this file, run:
  • LD_LIBRARY_PATH=/opt/VirtualBox* ./vditool SHRINK new-file.vdi

    • Now we’re all set up.

Notes for AMD64 users. The vditool executable above only works on 32 bit systems. If you have a 64bit system then use the "vditool" image and library path from your existing VirtualBox installation. The following commands suit an AMD64 system running Ubuntu 7.10:

  • LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool DD new-file.vdi old-file.bin LD_LIBRARY_PATH=/usr/lib/virtualbox /usr/lib/virtualbox/vditool SHRINK new-file.vdi

(These commands should actually work on both 32bit and 64bit systems).

Multiple vmdk files to single vdi

The problem is simple. Very often, maybe due to Fat32 partition limits, people split their VMWare disc images into multiple files. So how do you convert multiple .vmdk files into a single .vdi file for Virtual Box?

What you have to do is:

  • Download and install VMWare Server for your platform. It is freeware but proprietary software; it is opensourced but you’ll need to subscribe for a license to use it. We’ll just use this to convert multiple vmdk images into a single one. You can find VMWare Server here.
  • Run a terminal, move in the dir where you store your multiple vmdk disc images and run:
  • vmware-vdiskmanager -r source_multiples.vmdk -t 2 single_file.vmdk

And that’s all! The multiple vmdk images will be converted into one single vmdk image file. At that point you’ll be able to use this guide as normal to convert the newly obtained vmdk disc image into a single .vdi file!

Creating a new VirtualMachine

Just click on the "New" button on the upper left side of the window:

attachment:vboxscreen2.png

Now you can follow the Wizard.

attachment:vboxscreen3.png

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 run almost at the native machine speed into a VirtualBox Virtual Machine, try it to believe! Smile :) )

attachment:vboxscreen4.png

  • Now assign the amount of RAM memory to the Virtual Machine. I recommend not more than the half of your real physical memory.

attachment:vboxscreen5.png

  • Here's the Hard Disc selection page. If you didn't need to switch from VMWare to VirtualBox, that is, if you haven't got an HD Image to use, create a new one, otherwise (And that's the purpose of this How-To), in this screen choose the Virtual Disc Image we just converted, that is the .vdi file we obtained after the conversion!

attachment:vboxscreen6.png

  • 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: attachment:vboxscreen7.png

  • 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 a little your Network connection. I suggest you to set it on NAT.
  • * Under the USB option you can choose wheter to enable or disable USB handling by VirtualBox. Remember that if you enable it, while VirtualBox will be running, it will steal any plugged-in USB device from the real Machine! attachment:vboxscreen8.png

  • 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 a little set up will be required from inside the OS you’re using. For example, Windows will have a lot of problems 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 VBox, WinXP refused to start. I had to insert in the CD-Rom of my original WinXP CD, boot from CD and restore the windows installation! Windows reconfigured and installed each new virtual peripheral so that at reboot everything was okay and all my programs were left installed in their original locations.

Conclusions

VirtualBox is a wonderful Virtualization Tool, but you'll probably want some more information about it, since this is not intended as a user guide. Read the entire manual (linked to in the above Chapter) and also have a look at this page in the VirtualBox Website for interesting information about Network, Sharing Files between guest and host OSes and much more: http://www.virtualbox.org/wiki/User_HOWTOS

UbuntuMagazine/HowTo/Switching_From_VMWare_To_VirtualBox:_.vmdk_To_.vdi_Using_Qemu_+_VdiTool (last edited 2009-11-03 15:22:04 by emt200-31-198-34)