Export

Export all of the workload data (storage, images, files) to an external host, set up the utility host, and transform the boot disk.

Export Boot Disk

Copy the boot disk from the source environment to a utility server that will be used to prepare the image for upload to PCA.

The method you use depends on the source hypervisor and management platform. For example, on Oracle VM or PCA 2.4, obtain the .img file for the boot disk by copying it from the storage repository shown in the VM's vm.cfg file. Run the command on the compute node or Oracle VM Server (OVS). For example:

cd /OVS/Repositories/0004fb00000300007b2cd14ca0d48e8b/VirtualDisks
scp 0004fb0000120000fcd80512881d4979.img
utilityhost:/data/0004fb0000120000fcd80512881d4979.raw

In this example, the output file is renamed with the file extension .raw, an optional change that indicates that the Oracle VM .img file uses the 'raw disk' image format.

Export Private Cloud Appliance 2.x Storage Repositories

You have a couple of options for exporting storage repositories from Private Cloud Appliance 2.x deployments.

On Private Cloud Appliance 2.4, storage repositories are mounted to the compute nodes, which by default are on PCA's private networks and do not have a preconfigured network connection to the data center. In that case:

  • You can scp the .img file to either of the two management nodes.
  • Or, create a read-only Oracle VM repository export to the management nodes, and then scp to an external host.

The following steps are excerpted from the Oracle Private Cloud Appliance Backup Guide. This process can be used to bulk export all the VMs in an Oracle VM storage repository:

  1. In Oracle VM Manager, select the Servers and VMs tab. Under Server Pools, expand the server pool name to show the server names, and select one of the servers. In the management panel, from the Perspective drop down, select Repository Exports.
  2. Click the + icon. In the Create Repository Export dialog, select the repository to be exported. Enter the IP address or hostname of the host that will mount the NFS share, which is the address of either of the management nodes. In the Options field enter the options ro,no_root_squash to ensure a read-only mount that makes all of the repository files visible.
  3. Click OK and find the export in the list of Repository Exports.
  4. Copy the value in the Repository Path column and issue a mount command using the selected compute node as the NFS server. The management node will have a read-only view of the storage repository and you can copy disk images directly from the repository's VirtualDisks directory without having to scp it from a compute node first. For example:
    # mount 192.168.4.5:/OVS/Repositories/0004fb0000030000cc1d0d9dfba208d0/ /mnt
    # ls -la /mnt
    total 2077 
    drwxr-xr-x   8 root root  3896 Aug 10  2019 .
    dr-xr-xr-x. 22 root root  4096 Jan  5 20:10 ..
    drwx------   9 root root  3896 Jan 24 14:10 Assemblies
    drwx------   2 root root  3896 Dec  9 14:23 ISOs
    drwxr-xr-x   2 root root  3896 Aug  8  2019 lost+found
    -rw-------   1 root root 15014 Mar  9 11:48 .ovsmeta
    -rw-------   1 root root   151 Sep 10  2020 .ovsrepo
    drwx------  11 root root  3896 Nov 25 16:12 Templates
    drwx------   2 root root  8192 Mar  9 11:48 VirtualDisks
    drwx------  53 root root  3896 Mar  9 11:48 VirtualMachines

    You can optimize the mount options. For example:

    mount -o ro,bg,hard,rsize=524288,wsize=524288,nfsvers=3,tcp 192.168.4.5:/OVS/Repositories/0004fb0000030000cc1d0d9dfba208d0 /mnt

Locate and Export VM VirtualBox Disk Images

Oracle VM VirtualBox usually stores disk images in the directory VirtualBox VMs in a subdirectory with the same name as the VM.

  1. The VM information from the user interface provides the complete path:
    $ vboxmanage showvminfo "Solaris 11.4"|more
    Name: Solaris 11.4
    Groups: /
    Guest OS: Oracle Solaris 11 (64-bit)
    UUID: 3a4ce795-d6b1-44f8-a16b-8b7fb0fbb4a8
    Config file: /Users/jeff/VirtualBox VMs/Solaris 11.4/Solaris 11.4.vbox
    Snapshot folder: /Users/jeff/VirtualBox VMs/Solaris 11.4/Snapshots
    Log folder: /Users/jeff/VirtualBox VMs/Solaris 11.4/Logs
  2. Look inside that folder for the .vdi or .vmdk disk image for the VM’s boot disk, and scp that to the utility host.

Locate and Export KVM Disk Images

Virtual machine disk images can be located by issuing the command shown below:

  1. List disk images:
    $ virsh vol-list default
    Name Path
    ------------------------------------------------------------------------------
    guest-ol8-minimal-serial.qcow2 /home/admin/.local/share/libvirt/images/guest-ol8-minimalserial.qcow2
    guest-ol8-minimal.qcow2 /home/admin/.local/share/libvirt/images/guest-ol8-minimal.qcow2
    guest-ol8.qcow2 /home/admin/.local/share/libvirt/images/guest-ol8.qcow2
    guest-ovsx54-ol7.qcow2 /home/admin/.local/share/libvirt/images/guest-ovsx54-ol7.qcow2 
    juniper-kvm-ol7.qcow2 /home/admin/.local/share/libvirt/images/juniper-kvm-ol7.qcow2
  2. Locate the disk image for the VM you want to export to Private Cloud Appliance, and scp that to the utility host.

Locate and Export VMware Disk Images

VMware images can be exported to a "virtual appliance" which is actually a tar file containing the disk image.

Use a similar procedure to obtain the virtual appliance, then use the tar command to extract the .vmdk file from the .ova file, and copy it to the utility host.

Speed Up Export by Compressing Disk Image Files

Disk image files are large and copying them to other hosts can take a long time. This may go much faster if you use compression, especially for sparse disk images.

You can optionally compress the disk image file using a command like gzip or lzop to reduce the time to copy to the utility host. For example, using lzop and piping output to scp:

lzop -1 < 0004fb0000120000fcd80512881d4979.img | ssh utilityhost 'lzop -d > /data/0004fb0000120000fcd80512881d4979.raw' 

We use lzop for compression in this case because a fast network is available, so compression speed was more important than compression ratio. If you have a slower network, you may opt for another approach such as using gzip or bzip2:

gzip 0004fb00001200008190ce0329fdacdf.img
scp 0004fb00001200008190ce0329fdacdf.img.gz utilityhost:/data/

All of these methods, or using no compression at all, are equally valid and depend on your preferences.

Set Up the Utility Host

Create a utility host that runs Oracle Linux. This can be a virtual machine or a bare metal instance.

Prepare the utility host by installing the OCI CLI. See the section 1.2 of the Oracle Private Cloud Appliance User Guide for instructions.

Use the following commands to install qemu-img and virt-sparsify. This example assumes an Oracle Linux 7 host:

$ sudo yum upgrade 
$ sudo yum-config-manager --enable ol7_kvm_utils 
$ sudo yum install qemu-img libguestfs-tools

Transform Boot Disk

You may need to convert the boot disk to the open standard qcow2 format used by the PCA hypervisor.

Note:

It is recommended, but not strictly necessary, to convert disk images already in vmdk or qcow2 format and package them in a .oci file. The .oci file includes the disk image in qcow2 format, and image metadata. That ensures the correct metadata for the image is provided with the disk contents.
  1. You convert the boot disk on utility host that has access to OCI CLI, qemu-img command and other optional utilities.
  2. Process the boot disk on the boot disk being prepared for PCA. This is a necessary step for disk images from Oracle VM on Exalogic or PCA 2.x.

    Note:

    This step is optional for disk images in .vmdk format (VMware or Oracle VirtualBox). Files in qcow2 format from KVM do not need to be converted.
  3. On the utility node, enter a command like the following, substituting in the actual filename for the disk image file:
    $ qemu-img convert -f raw -O qcow2 0004fb0000120000fcd80512881d4979.raw output.QCOW2
    $ qemu-img convert -f vdi -O qcow2 ol8.vdi output.QCOW
    $ qemu-img convert -f vmdk -O qcow2 myVMwareVM.vmdk output.QCOW2
    • Use -f raw for virtual disks from Oracle VM and PCA 2.x
    • use -f vdi for .vdi files from Oracle VM VirtualBox
    • use -f vmdk for .vmdk images coming from VMware

    Note:

    1. You must name the output file output.QCOW2.
    2. The qemu-img command can take a substantial time to run depending on the image file size and the system speed. You can use the flag "-p" to show progress displayed as a percentage in the form (nn.nn/100%).

    It is recommended but not necessary to convert a .vmdk image because Private Cloud Appliance can use that file type. See the Migrate section later in this solution.

  4. You may be able to reduce the size of the disk image by using the virt-sparsify tool. This tool works on many file systems: ext2/3/4. xfs, btrfs, NTFS, LVM. and reduces sparse disk image size by eliminating disk blocks not owned by a file. The amount of reduction varies based on the contents of the disk image before exporting. Depending on your utility environment, you may have to also issue export LIBGUESTFS_BACKEND=direct before running the command:
    $ virt-sparsify --in-place output.QCOW2 

Prepare the OCI File Type for Import

Private Cloud Appliance X9-2 image and OCI images use the file type .oci, which has two components:

  • An image_metadata.json file that describes the image in JSON format, and the actual disk image named output.QCOW2 you created.
  • The image_metadata.json file describes the image's settings (BIOS vs. UEFI, how virtual devices are implemented), and what operating system it runs.

Select the BIOS or UEFI version based on the source and change the operating system description.

Oracle Exalogic images will be in BIOS mode.

$ tar zcf MyImage.oci image_metadata.json output.QCOW2

Example image_metadata.json Files

Use this example image_metadata.json file included in a .oci bundle for upload.

Review the following BIOS and UEFI metadata file versions and use whichever is relevant. Set the BIOS or UEFI version as determined by the source environment values for operatingSystem and operatingSystemVersion based on the imported image.

BIOS images


{
   "version": 2,
   "externalLaunchOptions": {
       "firmware": "BIOS",
       "networkType": "PARAVIRTUALIZED",
       "bootVolumeType": "PARAVIRTUALIZED",
       "remoteDataVolumeType": "PARAVIRTUALIZED",
       "localDataVolumeType": "PARAVIRTUALIZED",
       "launchOptionsSource": "CUSTOM",
       "pvAttachmentVersion": 1,
       "pvEncryptionInTransitEnabled": false,
       "consistentVolumeNamingEnabled": false
    },
    "imageCapabilityData": null,
    "imageCapsFormatVersion": null,
    "operatingSystem": "Oracle Linux",
    "operatingSystemVersion": "8.5"
}

UEFI images


{
    "version": 2,
    "externalLaunchOptions": {
        "firmware": "UEFI_64",
        "networkType": "PARAVIRTUALIZED",
        "bootVolumeType": "PARAVIRTUALIZED",
        "remoteDataVolumeType": "PARAVIRTUALIZED",
        "localDataVolumeType": "PARAVIRTUALIZED",
        "launchOptionsSource": "CUSTOM",
        "pvAttachmentVersion": 1,
        "pvEncryptionInTransitEnabled": false,
        "consistentVolumeNamingEnabled": false
     },
     "imageCapabilityData": null,
     "imageCapsFormatVersion": null,
     "operatingSystem": "Oracle Linux",
     "operatingSystemVersion": "7.9"
}