Fail back an ECS instance to on-premises VMware
Fail back a cloud-restored ECS instance to on-premises VMware by exporting a custom image as a VMDK file and using it to create a VM.
Prerequisites
Ensure the following:
-
A VMware VM backed up and restored to an ECS instance via Cloud Backup. For more information, see Restore a VMware VM as an ECS instance.
ImportantFailback is supported only for Linux ECS instances. For CentOS 7, if the system fails to start after failback, switch the disk controller to IDE and restart.
-
An OSS bucket in the same region as the custom image to temporarily store the exported image. For more information, see Create buckets.
Usage notes
-
You cannot export Windows Server images or images derived from Alibaba Cloud Marketplace due to copyright restrictions. For more information, see Export custom image.
-
The ECS instance must be created through Cloud Backup's VMware disaster recovery feature. Images from other ECS instances cannot boot in VMware.
Procedure
-
Downtime required: The ECS instance must be stopped during image creation. Schedule this during a maintenance window.
-
Time estimates: Creating and exporting large images can take hours depending on disk size.
-
Test first: Validate this procedure in a non-production environment before using it in production.
-
Create a custom image for the ECS instance. For more information, see Create a custom image from an instance.
-
Export the custom image to the OSS bucket. For more information, see Export custom image.
-
If the exported image format does not meet requirements, use the qemu-img tool to convert it. For more information, see Convert image formats.
-
Create a VMware VM by using the VMDK file.
Step 1: Create and export a custom image to OSS
Log on to the ECS console.
-
In the left-side navigation pane, choose .
In the upper-left corner of the page, select a region and resource group.
-
Find the instance from which you want to create a custom image. Choose in the Actions column.
-
In the Create Custom Image dialog box, enter a name, keep the default settings, and click OK.
ImportantCreating a custom image generates snapshots. Snapshot storage incurs charges while the image exists. For more information, see Snapshot billing.
Export the image only after it reaches the Available state.
In the left-side navigation pane, choose .
-
On the Custom Images tab, find the target image and click Export Image in the Actions column.
Important-
Download the image from OSS to your local computer.
-
Exporting a custom image incurs OSS storage and download traffic charges. For more information about the OSS billing, see Billing overview.
-
-
In the Export Image dialog box, review the notes and limits, then click Next. For more information about the limits, see Export custom image.
-
Specify the OSS Bucket and Image File Name Prefix parameters and click OK.
Important-
Images can be exported in RAW, VHD, QCOW2, VDI, or VMDK format. In regions without the Image Format option, images default to RAW. For more information, see Export custom image.
-
If the exported image is in RAW format, convert it to VMDK before creating the VMware VM.
-
-
In the left-side navigation pane, hover over Maintenance & Monitoring and select Tasks. On the Tasks page, view the export progress.
NoteExport time depends on image size and queue length. Click the task ID for details.
-
After the export completes, the image is saved in the specified OSS bucket.
Step 2: Download the image from OSS to your local computer
Download the exported image to your computer. For more information, see Download objects.
For RAW exports, the file extension is .raw.tar.gz. After decompression, the extension is .raw.
(Optional) Step 3: Convert the image from RAW to VMDK
If the exported image is doc_system.raw.tar.gz, perform the following steps.
-
If the exported image format does not meet requirements, use the qemu-img tool to convert it. For more information, see Convert image formats.
-
Ensure sufficient disk space before decompressing. A compressed 10 GB image may require 50+ GB when decompressed.
-
Decompress the
doc_system.raw.tar.gzfile to thedoc_system.rawfile. The exported file isdoc_system.raw.tar -xvzf doc_system.raw.tar.gz -
Convert the image to VMDK format. On CentOS, install qemu-img with
yum install qemu-img. The output file isdoc_system.vmdk.qemu-img convert -f raw -O vmdk doc_system.raw doc_system.vmdk
Step 4: Upload the VMDK file to VMware
-
Log on to the vSphere Web Client.
-
Find the desired datastore.
-
On the datastore details page, click UPLOAD FILES. Large files may take time to upload.
Step 5: Use the VMDK file (image) to create a new VMware VM
-
Log on to the vSphere Web Client.
-
Right-click a data center, host, or resource pool, choose New Virtual Machine, and click NEXT.
-
In the New Virtual Machine wizard, select Create a new virtual machine and click NEXT.
-
Specify the Virtual machine name, select a location, and click NEXT.
-
Select the compute resources and click NEXT.
-
Select a storage location and click NEXT.
-
Select compatibility and click NEXT.
-
Select an operating system and version, then click NEXT.
-
Configure VM hardware: CPU, memory, network, and other options.
-
Remove the default hard disk and add the uploaded VMDK file as the hard disk.
-
Click Add NEW DEVICE and select Existing Hard Disk.
-
Select the uploaded VMDK file, set Virtual Device Node to IDE 0, and click NEXT.
-
For multiple disk images, upload each VMDK file with IDE 0 as the virtual device node.
-
-
Review the configuration summary.
-
Click FINISH. The VM is created.
The ECS instance is now failed back to on-premises VMware. The VM uses the same credentials as the ECS instance. Verify and validate the failback as planned.
> Disks and Images > Create Custom Image