1.14. Importing and Exporting Virtual Machines

Oracle VM VirtualBox can import and export virtual machines in the following formats:

1.14.1. About the OVF Format

OVF is a cross-platform standard supported by many virtualization products which enables the creation of ready-made virtual machines that can then be imported into a hypervisor such as Oracle VM VirtualBox. Oracle VM VirtualBox makes OVF import and export easy to do, using the VirtualBox Manager window or the command-line interface.

Using OVF enables packaging of virtual appliances. These are disk images, together with configuration settings that can be distributed easily. This way one can offer complete ready-to-use software packages, including OSes with applications, that need no configuration or installation except for importing into Oracle VM VirtualBox.

Note

The OVF standard is complex, and support in Oracle VM VirtualBox is an ongoing process. In particular, no guarantee is made that Oracle VM VirtualBox supports all appliances created by other virtualization software. For a list of known limitations, see Known Limitations.

Appliances in OVF format can appear in the following variants:

  • They can come in several files, as one or several disk images, typically in the widely-used VMDK format. See Section 5.2, “Disk Image Files (VDI, VMDK, VHD, HDD)”. They also include a textual description file in an XML dialect with an .ovf extension. These files must then reside in the same directory for Oracle VM VirtualBox to be able to import them.

  • Alternatively, the above files can be packed together into a single archive file, typically with an .ova extension. Such archive files use a variant of the TAR archive format and can therefore be unpacked outside of Oracle VM VirtualBox with any utility that can unpack standard TAR files.

Note

OVF cannot describe snapshots that were taken for a virtual machine. As a result, when you export a virtual machine that has snapshots, only the current state of the machine will be exported. The disk images in the export will have a flattened state identical to the current state of the virtual machine.

1.14.2. Importing an Appliance in OVF Format

The following steps show how to import an appliance in OVF format.

  1. Double-click on the OVF or OVA file.

    Oracle VM VirtualBox creates file type associations automatically for any OVF and OVA files on your host OS.

  2. Select File, Import Appliance from the VirtualBox Manager window.

    From the file dialog, go to the file with either the .ovf or the .ova file extension.

    Click Import to open the Appliance Settings screen.

    Figure 1.12 Appliance Settings Screen for Import Appliance


    This screen shows the VMs described in the OVF or OVA file and enables you to change the VM settings.

    By default, membership of VM groups is preserved on import for VMs that were initially exported from Oracle VM VirtualBox. You can change this behavior by using the Primary Group setting for the VM.

    The following global settings apply to all of the VMs that you import:

    • Base Folder: Specifies the directory on the host in which to store the imported VMs.

      If an appliance has multiple VMs, you can specify a different directory for each VM by editing the Base Folder setting for the VM.

    • MAC Address Policy: Reinitializes the MAC addresses of network cards in your VMs prior to import, by default. You can override the default behavior and preserve the MAC addresses on import.

    • Import Hard Drives as VDI: Imports hard drives in the VDI format rather than in the default VMDK format.

  3. Click Import to import the appliance.

    Oracle VM VirtualBox copies the disk images and creates local VMs with the settings described on the Appliance Settings screen. The imported VMs are shown in the list of VMs in VirtualBox Manager.

    Because disk images are large, the VMDK images that are included with virtual appliances are shipped in a compressed format that cannot be used directly by VMs. So, the images are first unpacked and copied, which might take several minutes.

You can use the VBoxManage import command to import an appliance. See Section 7.10, “VBoxManage import”.

1.14.3. Exporting an Appliance in OVF Format

The following steps show how to export an appliance in OVF format.

  1. Select File, Export Appliance to open the Export Virtual Appliance wizard.

    From the initial window, you can combine several VMs into an OVF appliance.

    Select one or more VMs to export, and click Next.

  2. The Appliance Settings screen enables you to select the following settings:

    • Format: Selects the Open Virtualization Format value for the output files.

      The Oracle Cloud Infrastructure value exports the appliance to Oracle Cloud Infrastructure. See Section 1.14.5, “Exporting an Appliance to Oracle Cloud Infrastructure”.

    • File: Selects the location in which to store the exported files.

    • MAC Address Policy: Specifies whether to retain or reassign network card MAC addresses on export.

    • Write Manifest File: Enables you to include a manifest file in the exported archive file.

    • Include ISO Image Files: Enables you to include ISO image files in the exported archive file.

  3. Click Next to show the Virtual System Settings screen.

    You can edit settings for the virtual appliance. For example, you can change the name of the virtual appliance or add product information, such as vendor details or license text.

    Double-click the appropriate field to change its value.

  4. Click Export to begin the export process. Note that this operation might take several minutes.

You can use the VBoxManage export command to export an appliance. See Section 7.11, “VBoxManage export”.

1.14.4. Preparing for Oracle Cloud Infrastructure Integration

There are some common configuration steps you need to take before using Oracle VM VirtualBox to integrate with your Oracle Cloud Infrastructure account.

  • Install the Extension Pack. Cloud integration features are only available when you install the Oracle VM VirtualBox Extension Pack.

  • Create a key pair. Generate an API signing key pair that is used for API requests to Oracle Cloud Infrastructure.

    • The key pair is usually installed in the .oci folder in your home directory. For example, ~/.oci on a Linux system.

    • Upload the public key of the key pair to the cloud service.

    For step-by-step instructions for creating and uploading an API signing key for Oracle Cloud Infrastructure, see:

    https://docs.cloud.oracle.com/iaas/Content/API/Concepts/apisigningkey.htm#How

  • Create a cloud profile. The cloud profile contains resource identifiers for your cloud account, such as your user OCID, and the fingerprint for your public key. You can create a cloud profile in the following ways:

    • Automatically, by using the Cloud Profile Manager. See Section 1.14.7, “The Cloud Profile Manager”.

    • Automatically, by using the VBoxManage cloudprofile command. See Section 7.44, “VBoxManage cloudprofile”.

    • Manually, by creating an oci_config file in your Oracle VM VirtualBox global configuration directory. For example, this is $HOME/.config/VirtualBox/oci_config on a Linux host.

    • Manually, by creating a config file in your Oracle Cloud Infrastructure configuration directory. For example, this is $HOME/.oci/config on a Linux host.

      This is the same file that is used by the Oracle Cloud Infrastructure command line interface.

      Oracle VM VirtualBox automatically uses the config file if no cloud profile file is present in your global configuration directory. Alternatively, you can import this file manually into the Cloud Profile Manager.

    For more information about the cloud profile settings used by Oracle Cloud Infrastructure see:

    https://docs.cloud.oracle.com/iaas/Content/API/Concepts/sdkconfig.htm

  • Custom Linux images. To export a custom Linux image, prepare the VM as described here:

    https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/importingcustomimagelinux.htm

  • Subnets. When exporting a VM to cloud, ensure that the subnets that are used by source VMs are available in the target compartment on the cloud service.

1.14.5. Exporting an Appliance to Oracle Cloud Infrastructure

Oracle VM VirtualBox supports the export of VMs to an Oracle Cloud Infrastructure service. The exported VM is stored on Oracle Cloud Infrastructure as a custom image. You can configure whether a cloud instance is created and started after the export process has completed.

Before you can export a VM to Oracle Cloud Infrastructure ensure that you have done the required preconfiguration tasks, as described in Section 1.14.4, “Preparing for Oracle Cloud Infrastructure Integration”.

Perform the following steps to export a VM to Oracle Cloud Infrastructure:

  1. Select File, Export Appliance to open the Export Virtual Appliance wizard.

    Select a VM to export and click Next to open the Appliance Settings screen.

  2. From the Format drop-down list, select Oracle Cloud Infrastructure.

    In the Account drop-down list, select your Oracle Cloud Infrastructure account.

    You can set up Oracle Cloud Infrastructure accounts by using the Cloud Profile Manager.

    The list after the Account field shows the profile settings for your cloud account.

    Figure 1.13 Appliance Settings Screen, Showing Cloud Profile and Machine Creation Settings


    In the Machine Creation field, select an option to configure settings for a cloud instance created when you export to Oracle Cloud Infrastructure. The options enable you to do one of the following:

    • Configure settings for the cloud instance after you have finished exporting the VM.

    • Configure settings for the cloud instance before you start to export the VM.

    • Do not create a cloud instance when you export the VM.

    Click Next to make an API request to the Oracle Cloud Infrastructure service and open the Virtual System Settings screen.

  3. Optionally edit storage settings used for the exported virtual machine in Oracle Cloud Infrastructure. You can change the following settings:

    • The name of the bucket used to store the exported files.

    • Whether to store the custom image in Oracle Cloud Infrastructure.

    • The name for the custom image in Oracle Cloud Infrastructure.

    • The launch mode for the custom image.

      Paravirtualized mode gives improved performance and should be suitable for most Oracle VM VirtualBox VMs.

      Emulated mode is suitable for legacy OS images.

    Click Export to export the VM to Oracle Cloud Infrastructure.

    Depending on the selection in the Machine Creation field, the Cloud Virtual Machine Settings screen may be displayed before or after export. This screen enables you to configure settings for the cloud instance, such as Shape and Disk Size.

    Click Create. The VM is exported to Oracle Cloud Infrastructure.

    Depending on the Machine Creation setting, a cloud instance may be started after upload to Oracle Cloud Infrastructure is completed.

  4. Monitor the export process by using the Oracle Cloud Infrastructure Console.

You can also use the VBoxManage export command to export a VM to Oracle Cloud Infrastructure. See Section 7.11.2, “Export to Oracle Cloud Infrastructure”.

1.14.6. Importing an Instance from Oracle Cloud Infrastructure

Oracle VM VirtualBox supports the import of cloud instances from an Oracle Cloud Infrastructure service.

Before you can import an instance from Oracle Cloud Infrastructure ensure that you have done the required preconfiguration tasks, as described in Section 1.14.4, “Preparing for Oracle Cloud Infrastructure Integration”.

Perform the following steps to import an instance from Oracle Cloud Infrastructure:

  1. Select File, Import Appliance to open the Import Virtual Appliance wizard.

    In the Source drop-down list, select Oracle Cloud Infrastructure.

    In the Account drop-down list, select your Oracle Cloud Infrastructure account.

    You can set up Oracle Cloud Infrastructure accounts by using the Cloud Profile Manager.

    The list after the Account field shows the profile settings for your cloud account.

    Choose the required cloud instance from the list in the Machines field.

    Click Next to make an API request to the Oracle Cloud Infrastructure service and open the Appliance Settings screen.

  2. Optionally edit settings for the new local virtual machine.

    For example, you can edit the VM name and description.

    Figure 1.14 Import Cloud Instance Screen, Showing Profile Settings and VM Settings


    Click Import to import the instance from the cloud service.

  3. Monitor the import process by using the Oracle Cloud Infrastructure Console.

You can also use the VBoxManage import command to import an instance from Oracle Cloud Infrastructure. See Section 7.10.2, “Import from Oracle Cloud Infrastructure”.

Importing an Instance: Overview of Events

The following describes the sequence of events when you import an instance from Oracle Cloud Infrastructure.

  • A custom image is created from the boot volume of the instance.

  • The custom image is exported to an Oracle Cloud Infrastructure object and is stored using Object Storage in the bucket specified by the user.

  • The Oracle Cloud Infrastructure object is downloaded to the local host. The object is a TAR archive which contains a boot volume of the instance in QCOW2 format and a JSON file containing metadata related to the instance.

  • The boot volume of the instance is extracted from the archive and a new VMDK image is created by converting the boot volume into the VMDK format. The VMDK image is registered with Oracle VM VirtualBox.

  • A new VM is created using the VMDK image for the cloud instance.

    By default, the new VM is not started after import from Oracle Cloud Infrastructure.

  • The downloaded TAR archive is deleted after a successful import.

1.14.7. The Cloud Profile Manager

The Cloud Profile Manager is a component of Oracle VM VirtualBox that enables you to create, edit, and manage cloud profiles for your cloud service accounts.

Figure 1.15 The Cloud Profile Manager


To open the Cloud Profile Manager select File, Cloud Profile Manager from the VirtualBox Manager window.

You can use the Cloud Profile Manager to create a new cloud profile automatically or to create a cloud profile by importing settings from your Oracle Cloud Infrastructure configuration file.

Perform the following steps to create a new cloud profile automatically:

  1. Click the Add icon and specify a Name for the profile.

  2. Click Properties and specify the following property values for the profile:

    • Compartment OCID

    • Fingerprint of the public key

    • Location of the private key on the client device

    • (Optional) Passphrase for the private key, if the key is encrypted

    • Region OCID

    • Tenancy OCID

    • User OCID

    Some of these are settings for your Oracle Cloud Infrastructure account, which you can view from the Oracle Cloud Infrastructure Console.

  3. Click Apply to save your changes.

    The cloud profile settings are saved in the oci_config file in your Oracle VM VirtualBox global settings directory.

Perform the following steps to import an existing Oracle Cloud Infrastructure configuration file:

  1. Ensure that a config file is present in your Oracle Cloud Infrastructure configuration directory. For example, this is $HOME/.oci/config on a Linux host.

  2. Click the Import icon to open a dialog that prompts you to import cloud profiles from external files.

    Warning

    This action overwrites any cloud profiles that are in your Oracle VM VirtualBox global settings directory.

  3. Click Import.

    Your cloud profile settings are saved to the oci_config file in your Oracle VM VirtualBox global settings directory.

  4. Click Properties to show the cloud profile settings.

    Double-click on the appropriate field to change the value.

  5. Click Apply to save your changes.

1.14.8. Creating New Cloud Instances from a Custom Image

You can use Oracle VM VirtualBox to create new instances from a custom image on your cloud service.

Section 1.14.5, “Exporting an Appliance to Oracle Cloud Infrastructure” describes how to create a custom image when you are exporting a VM to Oracle Cloud Infrastructure. Using a custom image means that you can quickly create cloud instances without having to upload your image to the cloud service every time.

Before you can create a new cloud instance in Oracle Cloud Infrastructure ensure that you have done the required preconfiguration tasks, as described in Section 1.14.4, “Preparing for Oracle Cloud Infrastructure Integration”.

Perform the following steps to create a new cloud instance on Oracle Cloud Infrastructure:

  1. Select File, New Cloud VM to open the Create Cloud Virtual Machine wizard.

  2. From the Destination drop-down list, select Oracle Cloud Infrastructure.

    In the Account drop-down list, select your Oracle Cloud Infrastructure account.

    You can set up Oracle Cloud Infrastructure accounts by using the Cloud Profile Manager.

    The list after the Account field shows the profile settings for your cloud account.

    In the Images list, select from the custom images available on Oracle Cloud Infrastructure.

    Figure 1.16 New Cloud VM Wizard, Showing List of Custom Images


    Click Next to make an API request to the Oracle Cloud Infrastructure service and open the Cloud Virtual Machine Settings screen.

  3. Optionally edit settings used for the instance on Oracle Cloud Infrastructure.

    For example, you can edit the Disk Size and Shape used for the VM instance and the networking configuration.

    Click Create to create the new cloud instance.

  4. Monitor the instance creation process by using the Oracle Cloud Infrastructure Console.

You can also use the VBoxManage cloud instance command to create and manage instances on a cloud service. See Section 7.46, “VBoxManage cloud instance”.