How to easily port VirtualBox machines?

19

6

I have used VMware for a long time. VMware saves all the information for one machine in one directory. This means it is easy to zip and copy.

Now I switched to VirtualBox.

VirtualBox seems to save the machine's information in more than one directory, e.g., a machine I called "Windows 7 Basic" is apparently saved here:

C:\Users\edward\.VirtualBox\HardDrives\Windows 7 Basic.vdi
C:\Users\edward\.VirtualBox\Machines\Windows 7 Basic\…
(various directories and files)

What do I need to do to transport my "Windows 7 Basic" machine?

The fact that the data is saved under a "." directory and in various places suggests that there is some kind of export/import feature.

I found the "export appliance" feature so I assume this is it.

But I started it for an empty machine and it says "time remaining 1 hour 31 minutes".

Am I doing this right? Does it really take 1.5 hours to "export" a machine and perhaps 1.5 hours to import it again, so 3 hours to move a virtual machine?

Edward Tanguay

Posted 2009-08-02T20:55:31.127

Reputation: 11 955

Answers

14

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.

Lena Schimmel

Posted 2009-08-02T20:55:31.127

Reputation: 655

.vbox files use relative paths which work if everything is in the same directory; absolute paths will still be used in the "scattered" cases, like when there are disks which are not in a subdirectory of the .vbox file's location. – Kaz – 2015-03-13T18:35:57.587

2I do this almost everyday between Linux, Windows and MacOSX with very little problems. In fact once you have moved it the first time you can actually just copy the VDI file over – BinaryMisfit – 2009-08-03T11:07:26.977

5

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]

McDowell

Posted 2009-08-02T20:55:31.127

Reputation: 276

I used VBoxManage CloneVDI (instead of cloneHD) and it worked nicely. – Ash – 2010-05-31T05:37:05.443