Help Center> Image Management Service> User Guide> Creating a Private Image> Creating a System Disk Image from a Linux ECS

Creating a System Disk Image from a Linux ECS

Scenarios

If you have created a Linux ECS and configured it (such as software installation and application environment deployment) based on your business requirements, you can create a system disk image from the configured ECS. Then, the configurations will be applied to all the new ECSs created from this image.

Background

The following figure shows the process of creating a system disk image from an ECS.

Figure 1 Creating a system disk image and using it to create ECSs
  • System disk images are commonly used for application expansion. They can also be used for hybrid cloud deployment. For example, you can export a system disk image from the public cloud and then import it to a private cloud so as to synchronize resources from the public cloud to the private cloud. The procedure is as follows:
    1. Create a system disk image from an ECS.
    2. Export the image to an OBS bucket. For details, see Exporting Images.
    3. Download the image file from the OBS bucket and upload it to the private cloud.
  • You can create an image from a running ECS. In this process, do not stop, start, or restart the ECS. Otherwise, the image creation may fail.
  • The time required for creating an image depends on the ECS system disk size, network status, and number of concurrent tasks.
  • A system disk image will be created in the same region as the ECS that is used to create it. For example, if an ECS is located in the CN North-Beijing4 region, the system disk image created from the ECS will also be located in the CN North-Beijing4 region. If you want to use the image in another region, replicate it to the target region. For details, see Replicating Images Across Regions.
  • If an ECS has expired or been released, you can use the system disk image created from the ECS to restore it.

Prerequisites

Before creating a private image from an ECS:

  • Delete sensitive data in the ECS to prevent data security risks.
  • Ensure that the ECS is in the Running or Stopped state.
  • Check network configuration of the ECS and ensure that DHCP is configured for the NICs. For details, see Setting the NIC to DHCP.
  • Install special drivers. The normal running and advanced functions of some ECSs depend on certain drivers. For example, P1 ECSs depend on the NVIDIA driver. For details, see Installing Special Linux Drivers.
  • Check whether the one-click password reset plug-in has been installed in the ECS. The password reset function on the management console is available for the new ECSs created from the image only after the plug-in is installed. For details, see Installing the One-Click Password Reset Plug-In.
  • Check whether Cloud-Init has been installed in the ECS. The user data injection function on the management console is available for the new ECSs created from the image only after the tool is installed. For example, you can use the data injection function to set the login password for a new ECS. For details, see Installing Cloud-Init and Configuring Cloud-Init.
  • Delete network rule files to prevent NIC name drift on the ECSs created from the image. For details, see Deleting Files in the Network Rule Directory.
  • To ensure that the ECSs created from the image support both Xen and KVM virtualization, optimize the Linux ECS used to create the image, such as changing the disk ID in the GRUB and fstab files to UUID and installing native Xen and KVM drivers.

    For details, see steps 2 to 6 in Optimization Process.

  • If multiple data disks are attached to the ECS used to create the private image, the ECSs created from the image may be unavailable. Therefore, you need to detach all data disks from the ECS before using it to create the image. For details, see Detaching Data Disks from an ECS.
  • If data disks have been attached to the ECS and automatic partition mounting has been configured in the fstab file for the ECS, delete these configurations from the file before using the ECS to create a system disk image.

If the ECS is created from a public image, the one-click password reset plug-in and Cloud-Init have been installed by default. You can follow the guide to verify the installation.

Procedure

  1. Log in to the management console.
  2. Under Computing, click Image Management Service.

    The IMS console is displayed.

  3. Click Create Image in the upper right corner.
  4. Configure the following information:

    Table 1 and Table 2 list the parameters in the Image Type and Source and Image Information areas, respectively.

    Table 1 Image type and source

    Parameter

    Description

    Region

    Select a region close to your business.

    If you select an incorrect region here, you can replicate the created image to your desired region. For details, see Replicating an Image Across Regions.

    Type

    Select System disk image.

    Source

    Select ECS and select an ECS with required configurations.

    Table 2 Image information

    Parameter

    Description

    Encryption

    This parameter specifies the encryption attribute of the image. The value cannot be changed.

    • Only an unencrypted private image can be created from an unencrypted ECS.
    • Only an encrypted private image can be created from an encrypted ECS.

    Name

    Set a name for the image.

    Enterprise Project

    Select an enterprise project from the drop-down list. This parameter is available only when you have enabled the enterprise project function, or your account is an enterprise account. To enable this function, contact your customer manager.

    An enterprise project provides a cloud resource management mode, in which cloud resources and members are centrally managed by project.

    Tag

    (Optional) Set a tag key and a tag value for the image to easily identify and manage it.

    Description

    (Optional) Enter description of the image.

  5. Click Next.
  6. Confirm the parameters. Read and select the agreement, and click Submit.
  7. Go back to the private image list and view the image status.

    The time required for creating an image depends on the ECS system disk size, network status, and number of concurrent tasks. When the image status changes to Normal, the image is created successfully.

    • Do not perform any operation on the selected ECS or its associated resources during image creation.
    • An ECS created from an encrypted image is also encrypted. The key used for encrypting the ECS is the same as that used for encrypting the image.
    • An image created from an encrypted ECS is also encrypted. The key used for encrypting the image is the same as that used for encrypting the ECS.

Follow-up Operations

After a system disk image is created successfully, you can use the image to create an ECS or change the OS of an existing ECS to migrate data between two ECSs. For details, see the following: