How to Migrate a VM from VirtualBox 4.3 to VMware Workstation 11

This piece of extremely specific Howto information is brought to you courtesy of my #vExpert trial license for VMware Workstation 11.

I think Workstation was my first experience with VMware, back in the 2.x days. That or I was using vmware-server v1.x as a desktop virtualisation thing, as well as running servers. It was a while ago, so I thought I’d check out Workstation again.

I occasionally need to run up a Windows desktop when doing client work, since many of them have Windows applications, or use versions of Office. Honestly, Excel is better than LibreOffice Calc, even if Word does suck a great deal. There is still nothing as capable on Linux to replace MSProject or Visio, and when you have to work on the same file formats? Well, you’re better off using native Windows apps.

But I digress.

I figured a simple export/import would be easy enough, and it was certainly easier than the last migration I did from vmware-server to virtualbox some years back.

But it was not without its challenges.

The Export

Exporting a VM from VirtualBox is easy enough: vboxmanage export <vmname> -o <filename.ovf> --ovf10 did the trick for me:

$ vboxmanage export JPW-Windows7 -o jpw-windows7.ovf --ovf10
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully exported 1 machine(s).

The trouble with this command is that the resulting .ovf file isn’t quite right. When you attempt to import it with VMware Workstation 11, you get an error:

The problem here is that VirtualBox has exported things in a way that doesn’t quite work. When you go to import it, you get the following error:

 The import failed because <filename> did not pass OVF specification conformance or virtual hardware compliance checks.

ovf-import-failed-relax-specAnd then when you Retry, it fails:

Error importing OVF: Line 8: Invalid value ‘0’ for attribute ‘capacity’ on element ‘Disk’

Screenshot from 2015-04-09 14:44:55

How To Fix It

This error happens because, for whatever reason, the OVF file that VirtualBox exports has a capacity value of 0 for the disk attached to this VM. That breaks the import, because Workstation won’t let you have a disk of size 0, which is fair enough.

To fix it, we need to find out the size of this disk, and edit the OVF file (which is just an XML text file) to have the right capacity.

First step, get the location of the disk image:

$ vboxmanage showvminfo <vmname> | grep "SATA Controller"
Storage Controller Name (1): SATA Controller
SATA Controller (0, 0): /home/daedalus/VirtualBox VMs/JPW-Windows7/Snapshots/{2be001cb-84f6-4c70-8f75-272add0992b0}.vdi (UUID: 2be001cb-84f6-4c70-8f75-272add0992b0)

We’ll need that UUID value in the next command:

$ vboxmanage showhdinfo 2be001cb-84f6-4c70-8f75-272add0992b0
UUID: 2be001cb-84f6-4c70-8f75-272add0992b0
Parent UUID: f613aafe-97a4-43ae-93ab-0bf2cc3c267c
State: created
Type: normal (differencing)
Auto-Reset: off
Location: /home/daedalus/VirtualBox VMs/JPW-Windows7/Snapshots/{2be001cb-84f6-4c70-8f75-272add0992b0}.vdi
Storage format: VDI
Format variant: differencing default
Capacity: 20480 MBytes
Size on disk: 12635 MBytes
In use by VMs: JPW-Windows7 (UUID: e3066d59-d495-46e9-ab72-add031fe6bcf)

There it is: capacity of 20480 MBytes.

Now we edit the OVF file, which looks like this:

<?xml version="1.0"?>
<Envelope ovf:version="1.0" xml:lang="en-US" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vbox="http://www.virtualbox.org/ovf/machine">
 <References>
 <File ovf:href="jpw-windows7-disk2.vmdk" ovf:id="file1"/>
 </References>
 <DiskSection>
 <Info>List of the virtual disks used in the package</Info>
 <Disk ovf:capacity="0" ovf:diskId="vmdisk2" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="3fbc49dd-867e-42fb-ab56-c1377f7b209e"/>
 </DiskSection>
 <NetworkSection>
 <Info>Logical networks used in the package</Info>
 <Network ovf:name="Bridged">

etc.

See the <Disk ovf:capacity=”0″ part? That’s what we want to change, to look like this:

 <Info>List of the virtual disks used in the package</Info>
 <Disk ovf:capacity="20480" ovf:capacityAllocationUnits="MegaBytes" ovf:diskId="vmdisk2" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" vbox:uuid="3fbc49dd-867e-42fb-ab56-c1377f7b209e"/>
 </DiskSection>

Once you’d done that, the import with Workstation should work smoothly. No more error!

I had to manually add an audio card to the virtual machine once it had been imported, but once I’d done that, audio playback and recording connected to pulseaudio just fine.

Incidentally, I had to figure out what the syntax of the file was, and the information out there wasn’t very good, hence my writing this post. There specs you want to look at are here for the OVF format [PDF] and here for the valid values for capacityAllocationUnits [PDF].

Hope that helps.

Bookmark the permalink.

Comments are closed