Ubuntu – How to export and import VirtualBox VM images

virtualboxvirtualization

In VirtualBox you can create VM and it will store it on a folder inside the Default Machine Folder of VirtualBox.

For instance, after create an ubuntu-headless VM it will create an ubuntu-headless directory with a couple of files and more folders inside.

I want to get this VM working on another system with also VirtualBox, like a duplicate.

Will a simple copy/paste of this VM directory inside Default Machine Folder of the target system work?

TL;DR: How to transfer a VirtualBox image from one system to another?

Best Answer

Copy/pasting the VM files is not the way to go. You need to use the correct export/import feature of VirtualBox.

With the following instructions you will be able to transfer a VM across several different physical machines and it's also a good way to make backups.

Export

Open VirtualBox and enter into the File option to choice Export Appliance...

at the top left corner, then file and export appliance

You will then get an assistance window to help you generate the image.

  1. Select the VM to export
  2. Enter the output file path and name

    be careful with the output path and file name making sure to leave the file extension untouched

    You can choice a format, which I always leave the default OVF 1.

  3. Finally you can write metadata like Version and Description

Now you have an OVA file that you can carry to whatever machine to use it.

Import

Open VirtualBox and enter into the File option to choice Import

You will then get an assistance window to help you loading the image.

  1. Enter the path to the file that you have previously exported

    chose the previously generated file

  2. Then you can modify the settings of the VM like RAM size, CPU, etc.

    give a configuration according to your system, not all of it but enough

    My recommendation on this is to enable the Reinitialize the MAC address of all the network cards option

  3. Press Import and done!

Now you have cloned the VM from the host machine into another one