Export a custom image to OSS and download it locally for backup, migration, or offline analysis.
Usage notes
-
Encrypted images, custom images created from Alibaba Cloud Marketplace images, and Windows Server images cannot be exported.
-
Maximum data disk size per format:
-
RAW / VDI / QCOW2: 2 TiB
-
VHD: 2040 GiB
-
VMDK: 2000 GiB
If a disk exceeds these limits, distribute the data across multiple disks before exporting.
-
Procedure
Before you export
Prepare an OSS bucket in the same region as your custom image. Only Standard or Infrequent Access storage classes are supported. To create a bucket, see Create a bucket.
Export a custom image to OSS
Console
-
Go to ECS console - Images. Select your region and resource group.
-
On the Custom Images tab, find the image and click Export Image in the Actions column.
-
Review the Make Preparations checklist. Click Next, confirm the prerequisites, and click Continue.
-
Configure Export Image File.
-
Image Format: Default:
Auto-detect. Options: RAW, VHD, QCOW2, VDI, or VMDK. -
OSS Bucket: Select a bucket in the same region as the custom image.
-
Image File Name Prefix: Example: set to
Demoand the exported file name becomes Demo-[System-generated file name].
-
-
Click OK. Export duration depends on the image size and task queue.
Track progress or cancel the export on the ECS console - Task Management page. You can also verify the result in the OSS console.
API
Call ExportImage to export a custom image, or CancelTask to stop an ongoing export.
Download and use the image file
After the image is exported to OSS, download it to a local machine.
-
Download the image file to your local machine
-
5 GB or smaller: In the OSS console, locate the file in the bucket and click Download.
-
Larger than 5 GB: Use ossutil to download the file. It supports multi-threaded, resumable, and batch downloads.
-
-
Decompress the image file
RAW images are exported as.raw.tar.gzfiles. After decompression, the extension is.raw.-
On Linux, run
tar -xzf <image-file-name>.raw.tar.gz. -
On macOS, use
gnu-tarto avoid compatibility issues.
-
-
(Optional) Convert the image format
To convert an exported RAW image to another format, useqemu-img. See Convert image formats.
Billing
Exporting a custom image to OSS incurs the following costs:
-
OSS storage fees: Charged based on the exported image file size and storage duration.
-
OSS request fees: The export process calls OSS APIs for read and write operations, which incurs API request fees.
The image format affects the number of OSS API read operations and request fees. We recommend selecting VHD to minimize read operations.
-
OSS traffic fees: Downloading the image file from OSS to a local machine incurs outbound data transfer fees. Accessing it from an ECS instance in the same region is free.
Cost optimization tips
-
Clean up promptly: After downloading and verifying the image file, delete it from OSS to reduce storage costs.
-
Archive data: For long-term backup, configure an OSS lifecycle rule to transition the file to a lower-cost storage class, such as Infrequent Access or Archive, after a specified period.
FAQ
How do I fix a failed image export?
If an image export fails, find the error code on the ECS console - Task Management page or by calling DescribeTaskAttribute.
|
Error code |
Cause |
Troubleshooting |
Solution |
|
IMAGE_ALREADY_EXIST |
A file with the same name exists in the OSS bucket. |
Check whether a file with the same name exists in the destination bucket. |
|
How can I export a custom image if a single data disk is larger than 2 TiB?
If a data disk is larger than 2 TiB, copy its data to multiple smaller disks (each under 2 TiB), create a custom image from these disks, and export it:
-
Log on to the instance. Run
df -hto check the data disk capacity. Create new empty disks based on the required capacity, attach them to the instance, and copy data from the original disk. -
Create snapshots of the new disks and the system disk.
-
Create a custom image from the snapshots and export it.
What are the different files in a multi-file image export?
If a custom image includes a data disk snapshot, files with system in their names correspond to the system disk, and files with data correspond to data disks. Data disk files include a mount point identifier (such as xvdb or xvdc) to distinguish them.
Can an encrypted image be decrypted and then exported?
Encryption is irreversible. An encrypted image cannot be decrypted for export, and the data remains encrypted after export.
To export data from an encrypted image, create an ECS instance from it, migrate the data, and create a new unencrypted custom image to export.