If you have a pre-configured VirtualBox VM with the XML file, you can easily add it to the VMs list in VirtualBox. Usually, when we create a new VM from the interface, it comes under the VMs list. But if you have virtual machines installed on a different host or from other versions of Windows OS on the same host, you can use the following method to import/add to the current list. In this small guide let me show how to import the VirtualBox XML files.
You can avoid the creation of new VMs if you can import the existing virtual machines from an XML file. Also, this method brings back all settings, VM state and even the snapshots.
Here is my current list of VMs. I’m going to import a Linux Ubuntu VM which was installed in my previous OS but stays on the same host.
Where is the VirtualBox XML File?
The XML file of the particular virtual machine is stored in the machine folder in Windows OS. You will find the XML file in the same place wherever you created and stored the VM. In some cases, you may not find the XML for the VM. This is because the same configuration and settings of the virtual machine are stored as a .vbox file. The purpose of both files is almost identical. We can use the .vbox file to export and import virtual machines in different hosts or the same host.
Import VirtualBox XML file in Windows
1) In the VirtualBox console menu, click on Machine and click Add.
2) Browse the XML or vbox file of the virtual machine you want to import.
3) This would add the particular virtual machine to VirtualBox’s VMs list in the current Operating System.
If there is no option to import the XML file like this, we may need to create a new virtual machine and select the existing hard disk VDI file to use the VM.
If the pre-configured virtual machine’s XML and other files are moved or copied from a different partition or computer, then the imported virtual machine will not work properly. Because, the configuration file XML or vbox will have the disk, snapshots, attached drives and log files that are located in the different partitions/drive letters.
Either we need to copy the files to the correct location on the new host as per on XML file or, modify the XML file with the correct drive letter. We should be able to move/import the working VMs from another location or host on a Windows computer. These methods are applicable for Linux and macOS Operating Systems also with the Oracle VirtualBox.