How to easily port VirtualBox machines?

Solution 1:

You can just copy the files inside the directories you mentioned, that is, the virtual harddisk (.vdi) and the xml-based description of the virtual machine. I did this twice, even cross plattform (a XP geust from an OS X host to a Windows XP host, and an Ubuntu guest from a Windows Vista Host to an OS X host) and it worked fine.

There may be two issues:

  • Both VDIs will have the same UUIDs, which is certainly not how it is intended
  • You may have to make minor changes to the XML-based machine defintion. I remember that it once contained an absolute path to the vdi, which was not valid after the host-to-host transfer. However, I think newer versions of virtual box do not use absolute paths.

Solution 2:

The export feature saves the image in OVF format. From the manual:

OVF is a cross-platform standard supported by many virtualization products which allows for creating ready-made virtual machines that can then be imported into a virtualizer such as VirtualBox

I believe you want the VBoxManage clonehd command.

This command duplicates a registered virtual hard disk image to a new image file with a new unique identifier (UUID). The new image can be transferred to another host system or imported into VirtualBox again using the Virtual Disk Manager...

VBoxManage clonehd <uuid>|<filename> <outputfile>
[--format VDI|VMDK|VHD|RAW|<other>]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--type normal|writethrough|immutable]
[--remember]