Creating the image of an existing virtual machine from Oracle VirtualBox as an appliance can help you move the VM from one host to another or Oracle Cloud or even upload it to the Internet, which can be downloaded and imported by others easily.
This post explains how to export a VirtualBox image of existing machine that can be shared and uploaded. Every virtual machine has its configuration, virtual disk, snapshot, log, and other temporary files. The location of these files can be anywhere on a computer as long as they are accessible.
Copying these files manually and editing the configuration file may help to migrate the virtual machine, but that is not the professional way. Creating a VirtualBox image as an appliance is the ideal and professional way we will discuss here.
VirtualBox has a built-in feature to export the virtual machine in OVF (Open Virtualization Format). The OVF will work on other hosts with VirtualBox and other OVF-supported products.
When you create a VirtualBox Image with the export feature, it creates OVF and virtual hard disk (VMDK) files for the specific virtual machine, and it doesn’t matter how many snapshots exist to the VM in different locations. Therefore, sharing and uploading Virtual machines via the Internet or on portable media such as USB or external hard disks become easy with these exported images.
Steps to Create VirtualBox Image of Existing Machine
The below screenshots were taken from the different versions of VirtualBox; ultimately, you will not see much difference in your version. Select the appropriate options while doing the export.
1) Go to the File menu and select Export Appliance.
2) Select the virtual machine you want to export and create the image on the next screen. The appliance image will contain all the required files to import and use on the different hosts.
Make sure that the particular VM is not powered on now. It should be turned off.
3) Select the format and location of the OVF file on the next screen. The virtual hard disk file VMDK also will be saved here.
Depending on the destination host, you can change the other OVF formats. It is better to leave the default one if you are unsure about the other hosts.
If an ISO file is attached to the particular VM, you can also include that in the export. In most cases, it is not required because we will create an image of a fully working OS VM, which may not require the installation ISO file.
4) Next screen allows modifying the options in exporting VirtualBox image. You can modify the values by double-clicking them. Adding the right information will make the export professional if you are going to share on the Internet.
5) Creating the image process will start with a progress bar, as shown below. Depending on the size of the VM and the number of split snapshots, it will take some time to export the image.
6) The exported existing virtual machine image will be at the selected destination (see figure below).
In this example, my virtual machine Ubuntu10.10 got several snapshot files. But by the export feature, all of them are merged and came with two files.
Depending on where you will use this image, you can further zip it to make it a single file. In another case, if these two files are too big to upload to the Internet, you can use the file utility tools to split and share them in multiple files. The end user can use the 7zip or other tools to extract and get the original files before importing the appliance.
I’m sure this post is straightforward to create a VirtualBox image of an existing machine in a universal format that can be imported on any platform. The above OVF file can be imported by the ‘Import Appliance’ option in the VirtualBox console menu.
Additional Note: If your virtual machine doesn’t have any snapshots, sharing the virtual machine’s working VDI file will fulfil the requirements. The end user can create a new VM matching the OS type and use the existing hard disk option to use the pre-installed VDI file. Since it has a few manual methods, the recommended way is to create and export the VirtualBox image using the steps mentioned in this guide.