Updated on 2024-10-31 GMT+08:00

Preparing an Image File

You need to prepare an image file that can be used to create a private image.

Currently, a large image file (maximum: 1 TB) can be imported only in RAW or ZVHD2 format. In addition to the requirements described in Table 2, a bitmap file needs to be generated alongside each RAW image file. The bitmap file is uploaded together with the image file. For details, see Fast Import of an Image File.

Initial Configuration for an Image File

The initial configuration must be completed on the source VM before an image file is exported from it. If you did not configure it, use the image file to create an ECS, configure the ECS, and use the ECS to create a private image. For details, see What Do I Do If a Linux Image File Is Not Pre-Configured When I Use It to Register a Private Image?

Table 1 Initial configuration for an image file

Configuration Item

How to Configure

Network

DHCP must be configured. Otherwise, the ECS startup or network capability will be abnormal. For details, see:

The following value-added operations are optional:

  • Enabling NIC multi-queue

    NIC multi-queue enables multiple vCPUs to process NIC interrupts, thereby improving network PPS and I/O performance. For details, see How Do I Enable NIC Multi-Queue for an Image?

  • Configuring dynamic assignment of IPv6 addresses

    IPv6 addresses are used to deal with IPv4 address exhaustion. If dynamic configuration is enabled in an image file, the ECSs created from this file will be automatically assigned an IPv6 address. These ECSs will support both IPv4 and IPv6 addresses. Configure dynamic assignment of IPv6 addresses. For details, see How Do I Configure an ECS to Use DHCPv6?

Tools

You are advised to install Cloud-Init.

Cloud-Init is an open-source tool for cloud instance initialization. When creating ECSs from an image with Cloud-Init, you can use user data injection to customize initialization details (for example, an ECS login password) to the ECSs. You can also configure and manage a running ECS by querying and using metadata. If Cloud-Init is not installed, you cannot apply these custom configurations to your ECSs, and you will have to use the original password in the image file to log in to the ECSs.

For details, see Installing Cloud-Init.

Plug-ins

You are advised to install the password reset plug-in CloudResetPwdAgent before creating a private image. In this way, you can reset the password of ECSs created from the image by a few clicks.

For details, see Installing the One-Click Password Reset Plug-In.

Drivers

Installing native KVM drivers

File system

Data disks

If multiple data disks are attached to the ECS used to create a private image, ECSs created from the image may be unavailable. Therefore, you need to detach all data disks from the ECS before using it to create a private image.

For details, see Detaching Data Disks from an ECS.

Image File Properties

Table 2 Linux image file properties

Image File Property

Requirement

OS

  • SUSE, Oracle Linux, Red Hat, Ubuntu, openSUSE, CentOS, Debian, Fedora, EulerOS, and NeoKylin
  • 32-bit or 64-bit
  • The OS cannot be bound to specific hardware.
  • The OS must support full virtualization.

For details about the supported OS versions, see External Image File Formats and Supported OSs. These OSs support automatic configuration. For details, see What Will the System Do to an Image File When I Use the File to Register a Private Image? For other OSs, check and install VirtIO drivers (see Installing Native KVM Drivers). On the image registration page, select Other Linux. After the image is imported, whether the system is started depends on the driver integrity.

Image format

VMDK, VHD, QCOW2, RAW, VHDX, QED, VDI, QCOW, ZVHD2, and ZVHD

Image size

Maximum file size: 128 GB

If the image size is between 128 GB and 1 TB, convert the image file into RAW or ZVHD2 and import it using fast import.

Other

  • Currently, images with data disks cannot be created. The image file must contain only a system disk, and the system disk size must be [40 GB, 1024 GB].
  • The initial password in the image file must contain uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?).
  • The boot partition and system partition must be on the same disk.
  • Generally, the boot mode is BIOS in an image. Some OS images support the UEFI boot mode. For details, see "OSs Supporting UEFI Boot Mode" in Image Service Management User Guide.
  • The /etc/fstab file cannot contain automatic mounting information of non-system disks. Otherwise, the login to the created ECS may fail.
  • If the external image file uses LVM as the system disk, ECSs created from the private image do not support file injection.
  • If the VM where the external image file is located has been shut down, it must be a graceful shutdown. Otherwise, a blue screen may occur when the ECS created from the private image is started.