You can migrate on-premises Oracle Linux images to Oracle Cloud Infrastructure with the oci-image-migrate utilities.
Note
The oci-image-migrate utilities are not part of the preinstalled OCI Utilities, but are available from the addons repository. You must manually install the oci-image-migrate utilities on your on-premises image.
Compatibility
You can use the utilities to migrate both virtual machines and physical hosts to Oracle Cloud Infrastructure. To migrate, you must create a compatible disk image and save it in a shared location where an Oracle Linux host can access it. The migration utilities work with the default Oracle VM VirtualBox disk image format (VMDK), or the QEMU copy-on-write disk image format (QCOW2) that is commonly used with Oracle Linux KVM.
How the Utilities Alter the Image
The utilities verify the virtual machine's operating system is supported, and perform necessary changes to ensure it runs correctly as a compute instance on Oracle Cloud Infrastructure. To learn more about the changes that these utilities automate, refer to Bring Your Own Device (BYOI).
Migrating an Image with oci-image-migrate
Install the oci-image-migrate utilities, convert any physical installations to a virtual disk image, and migrate the virtual disk image to Oracle Cloud Infrastructure.
If you intend to migrate a physical installation, install the qemu-img package:
Copy
sudo yum install -y qemu-img
Converting a Physical Installation to a Virtual Disk Image 🔗
To migrate a physical installation, create a raw disk image and then convert it into a virtual hard disk format (either VMDK or QCOW2). You can then follow the instructions in Migrating a Virtual Disk Image.
Create the Raw Disk Image
Before shutting down the physical machine to create the image, temporarily include all device drivers in the initial ramdisk (initramfs):
Copy
sudo dracut --force --no-hostonly
After powering down the physical machine, use a recovery system to create a disk image to an external location:
Select a disk format VMDK (compatible with Oracle VM Virtualbox) or QCOW2 (compatible with Oracle Linux KVM), and then convert the disk image.
Option 1: Convert to Virtual Machine Disk Format (VMDK)
Convert your raw disk image to Virtual Machine Disk (VMDK) format. This file format is used for virtual hard disks that are compatible with Oracle VM Virtualbox.
qemu-img convert -f raw -p -O vmdk raw_disk_imageexported_file.vmdk
Optionally test your virtual hard disk before packaging and importing it into Oracle Cloud Infrastructure.
For more information, refer to the Disk Image Files section in the Oracle VM VirtualBox documentation. For more information about the qemu-img command, refer to the qemu-img(1) man page.
Option 2: Convert to QEMU Copy-on-Write Format (QCOW2)
Convert your raw disk image to QEMU copy-on-write (QCOW2). This storage format is used for virtual hard disks that are compatible with Oracle Linux KVM.
qemu-img convert -f raw -p -c -O qcow2 raw_disk_imageexported_file.qcow2
Optionally test your virtual hard disk before packaging and importing it into Oracle Cloud Infrastructure.
Prepares an on-premise image for importing into Oracle Cloud Infrastructure. You must run this command as root.
The oci-image-migrate utility supports the migration of image files in qcow2 and vmdk format.
The utility does the following to prepare the image for migration:
Verifies the prerequisites for importing the image.
Disables the network interfaces except the primary network interface, which is set up as a DHCP client.
Installs recommended packages, such as the cloud-init package. The list of packages that are installed are displayed in /etc/oci-utils/oci-migrate-conf.yaml file.
Attempts to access remote servers hosting software repositories for the image being processed. The Domain Name Server (DNS) names servers and proxy settings must be able to reach the software repositories.
Specify the full path for the unprocessed virtual hard disk. This option is mandatory.
-y | --yes
Answer "yes" to prompts.
-v | --verbose
Display detailed information during image processing on the terminal. This information can for troubleshooting errors or monitoring the status. This debugging information is also written to /var/tmp.
Uploads an on-premise image file to an object storage bucket in Oracle Cloud Infrastructure. This command does not require root privileges, provided you can access the object storage bucket in Oracle Cloud Infrastructure and have write privileges to the directories where the log and results files are written (/var/tmp/).
Specify the full path for processed virtual hard disk. This option is mandatory.
-b bucket_name | --bucket-name bucket_name
Specify the name of the object storage bucket in Oracle Cloud Infrastructure to store the image file. This option is mandatory.
-o output_name | --output-name output_name
Specify the name of the image file to be used in object storage. If not specified, the name of the processed virtual hard disk is used as the image name.
-y | --yes
Answer "yes" to prompts.
-v | --verbose
Display detailed information during image upload processing on the terminal. Use this information for troubleshooting errors or monitoring the status. This debugging information is also written to /var/tmp.
-h | --help
Display a summary of the command line options.
Example
$ oci-image-migrate-upload -v -i /omv/data/images/ol79.vmdk -b test_bucket_001 -o ol79_demo.qcow2
Uploading ol79.vmdk -b test_bucket_001 -o ol79_demo.qcow2 at Thu Mar 25 20:44:16 2021
Uploading /omv/data/images/ol79.vmdk to object storage test_bucket_001 in the Oracle Cloud Infrastructure as ol79_demo.qcow2
Object storage test_bucket_001 present.
Agree to proceed uploading /omv/data/images/ol79.vmdk to test_bucket_001 as ol79_demo.qcow2? (y/N) y
Uploading /omv/data/images/ol79.vmdk, this may take a while....
00:03:12 [ uploading ol79_demo.qcow2
oci-image-migrate-import 🔗
Description
Imports an image from object storage to custom images repository in Oracle Cloud Infrastructure. This command does not require root privileges, provided you can access the object storage bucket in Oracle Cloud Infrastructure and have write privileges to the directories where the log and results files are written (/var/tmp/).
Specify the name of the destination compartment. This option is mandatory.
-d display_name | --display-name display_name
Specify the name to be displayed for the custom image in the custom images repository in Oracle Cloud Infrastructure. If this parameter is not specified, the image name is used as the display name.
-l launch_mode | --launch-mode launch_mode
Specify the launch mode that the custom image uses when launched. Possible values are PARAVIRTUALIZED, EMULATED, and NATIVE. If a mode is not specified, the default is PARAVIRTUALIZED.
-v | --verbose
Display detailed information during image import processing on the terminal. Use this information for troubleshooting errors or monitoring the progress. This debugging information is also written to /var/tmp.
-y | --yes
Answer "yes" to prompts.
-h | --help
Display a summary of the command line options.
Example
$ oci-image-migrate-import -v -y -i ol79_demo.qcow2 -b test_bucket_001 -c OLimages -d ol79_demo
Importing ol79_demo.qcow2 from test_bucket_001 into test_bucket_001 as ol79_demo and setting launch mode as PARAVIRTUALIZED
Object storage namespace: IMAGETEST
Compartment: OLimages
Object storage test_bucket_001 present.
Import ol79_demo.qcow2 to OLimages as ol79_demo y
00:00:05 [ importing ol79_demo