Updated on 2024-04-15 GMT+08:00

Creating a System Disk Image from a Linux ECS

Scenarios

If you have created and configured a Linux ECS based on your service requirements (for example, by installing software and setting up an application environment), you can create a system disk image based on this configured ECS. Then, all new ECSs created from this image will have the same software and environment preinstalled.

Creating a system disk image does not affect the running of services on the ECS or cause data loss.

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 often used for application scale-out. They can also be used for hybrid cloud deployment. You can create system disk images for resource synchronization on and off cloud. The procedure is as follows:
    1. Create a system disk image from an ECS.
      If the ECS is created from any of the following images, the system disk image cannot be exported:
      • ISO image
      • Private image created from a SUSE, Red Hat, Ubuntu, or Oracle Linux public image
    2. Export the image to an OBS bucket. For details, see Exporting an Image.
    3. Download the image file from the OBS bucket.
  • You can create an image from a running ECS.

    The image creation does not affect service running on the ECS.

    In this process, do not stop, start, or restart the ECS, or the image creation may fail.

  • The time required for creating an image depends on the ECS system disk size, network quality, and the number of concurrent tasks.
  • A system disk image will be created in the same region as the ECS that was used to create it.
  • 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 any sensitive data the ECS may contain.
  • 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, H2 ECSs depend on the InfiniBand NIC driver. For details, see Installing Special Linux Drivers.
  • Check whether the one-click password reset plug-in has been installed on the ECS. The password reset function on the management console is only available for new ECSs that have this plug-in installed. For details, see Installing the One-Click Password Reset Plug-In.
  • Check whether Cloud-Init has been installed on the ECS. The user data injection function on the management console is only available for new ECSs that have this tool installed. You can use data injection, for example, to set the login password for a new ECS. For details, see Installing Cloud-Init and Configuring Cloud-Init.
  • Delete any network rules to prevent NIC name drift on the ECSs created from the image. For details, see Deleting Files from the Network Rule Directory.
  • To ensure that the ECSs created from the image support both Xen and KVM virtualization, the Linux ECS used to create the image has to be modified. For instance, the disk IDs in the GRUB and fstab files need to be UUID and native Xen and KVM drivers need to be installed.

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

  • If multiple data disks are attached to an ECS used to create a private image, the ECSs created from the image may be unavailable. You need to detach all data disks from the ECS before using it to create an 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 an 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.

If an ECS is created from a public image, Cloud-Init has been installed by default. You can follow the guide to verify the installation.

Procedure

  1. Access the IMS console.

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

      The IMS console is displayed.

  2. Create a system disk image.

    1. Click Create Image in the upper right corner.
    2. Set image parameters.

      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

      Type

      Select System disk image.

      Source

      Select ECS and select an ECS with required configurations.

      Table 2 Image information

      Parameter

      Description

      Name

      Set a name for the image.

      Description

      (Optional) Enter a description of the image.

      The parameters may vary depending on enterprises and organizations.

    3. Click Apply Now.
    4. Confirm the settings and click Submit Application.

  3. Go back to the Private Images page and view the new system disk image.

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

    • Do not perform any operations on the selected ECS or its associated resources during image creation.

Follow-up Procedure

After a system disk image is created, you can: