How to migrate a virtual machine

By Pluralsight on Not published yet

Facing migration problems between Virtualbox and VMware? You're not alone. In my daily work as programmer, Virtualbox has brought a lot of fun and success. That is, until recently when I upgraded to Virtualbox 4.2.6 build 82870 in my Windows 8 installation with horrible results. In this tutorial, we'll go step-by-step through a solution that won't take up too much of your time, and will hopefully be just the fix you need. 

The problem

Upgrading turned out to be a bad idea, as it corrupted the VC++ Redistributables Libraries that other programs use (I Debug with Nusphere PHPEd my apps in PHP). If I was able to reinstall PHPEd, Virtualbox was then rendered useless. And If tried to work with virtualbox, PHPEd refused to debug ignoring the VM. It was complete mess!

Having the knife on my neck due projects and looming deadlines, I decided to move to VMWare Workstation--but I had to act quickly. I had no time to install, create and configure my new VM or to reinstall my windows, plus I wanted to convert from VDI (the common type of Hard Disk VirtualBox uses by default since 4.1.x). Also, the GUI provided for Virtualbox didn’t give me any option to convert the hard disk to VMDK (the default format of VMWare for virtual hard disks).

At this point, my only chance was the command line support of VirtualBox, which is excellent and bullet proof. From here, we’ll go through 14 steps (if you have a virtual hard disk of 80 GB with support for dynamic disk expansion, this should take around an hour and a half). Ready? Good, let’s get started.

The solution

Requirements:

  • Your virtualbox vm should be off. Detach any network setting.
  • Any virtualbox release above of 4.x
  • The location of your VDI file in your hard disk.
  • VMware Workstation 9 or higher.

Environment:

I’m working in a Windows 8 Pro X64, with 8GB in Ram, 750GB in HD and Intel i7 Core Sandy Bridge Second gen. Nearly all procedures should work with computers with windows 7 x64, iOS and Ubuntu. There’s no difference on the OS, what we need is to Convert the VDI file to VMDK format.

Step 1: This step must work in any OS, the only difference here is how we reach our installation through the terminal. For this case, I’ll execute this under Windows. Once we locate the VDI File with our file manager we need to go to the terminal and locate the installation of Virtualbox. In a windows 7/8 X64 machine it should be:

 C:\Program Files\Oracle\VirtualBox

So, we do this:

cd "C:\Program Files\Oracle\VirtualBox"

Once we reach this point we need to execute the following line (remember the location of your VDI file!):

   Vboxmanage.exe clonehd "C:\myvm\myharddisk.vdi" "C:\myvm\myharddisk.vmdk" -format VMDK -variant standard

As soon as we press enter, the conversion will start. Depending on the size of your hard disk it will take around one hour if you’ve used 50GB of space of your dynamic hard disk expansion in Virtualbox. So, now is a good time to take your coffee break, do your laundry or play your favorite game.

Step 2: Now that the conversion has reached 100 percent (and you’re well caffeinated), we can safely move the new vmdk file to a location of our convenience. Run VMware Workstation and start the wizard for creating a new virtual machine.

We should execute a custom installation since we will link the converted VMDK disk in a new machine.

Step 3: No changes here, use Workstation 9 as default.

Step 4: We do not need really to reinstall the Operative System, so it’s safe to choose the option: “I will Install the operating system later.”

Step 5: Choose Linux, then Ubuntu. Sometimes it appears as default.

Step 6: Name the virtual machine however you want. You can also change the default location of the virtual machine if needed.

Step 7: To match the processors used in my virtualbox virtual machine, I assign the same amount of processors and cores for the new virtual machine.

Step 8: I do exactly the same as in the previous step; match the amount of memory to be assigned to this virtual machine.

Step 9: Use the NAT for the moment. Later on you can configure a bridged network connection to make your VM visible to your network.

Step 10: Here we will choose the Hard Disk to be used. Locate your converted VMDK disk and continue.

Step 11: Give the location of your converted VMDK disk.

Step 12: Here is the tricky part. Since I don't know if I will use VirtualBox in the near future, I didn't converted to a recent format. I want to have a Fallback measure if things goes wrong. Once this part is finished, we can test the new virtual machine on VMware.

Step 13: Now the only thing we need to do is to start the new Virtual Machine.

Step 14: Congratulations! Migration was painless and now I can reinstall PHPEd and go back to work!

Takeaway

Crazy ride, isn't it? After this last step you need to reconfigure your network and add the VMware additions to your virtual machine. I hope this tutorial has been helpful for anyone facing migration problems between Virtualbox and VMware, and I hope you have enjoyed this article. Please feel free to reach out directly, or leave a comment below, if you need any help.

Get our content first. In your inbox.

Loading form...

If this message remains, it may be due to cookies being disabled or to an ad blocker.

Contributor

Erick Rodriguez