Help Center/ Elastic Cloud Server/ User Guide/ Instances/ Modifying ECS Specifications (vCPUs and Memory)/ Automatically Changing a Xen ECS to a KVM ECS (Linux)
Updated on 2025-07-25 GMT+08:00

Automatically Changing a Xen ECS to a KVM ECS (Linux)

Scenarios

Before changing a Xen ECS that runs Linux to a KVM ECS, make sure that the required drivers have been installed and configured on the ECS.

This section describes how to use a script to automatically install drivers on the ECS, configure the device name, and change Xen to KVM.

  • Xen ECS flavors: S1, C1, C2, and M1.
  • KVM ECS flavors: See the Virtualization column in ECS Specifications.
  • To support both Xen and KVM, Linux ECSs require the xen-pv and virtio drivers. Before changing a Xen ECS to a KVM ECS, make sure that the Linux ECS has been configured, including driver installation and automatic disk attachment.

Constraints

  • The ECS needs to be stopped during the specification modification, so you are advised to perform this operation during off-peak hours.
  • To prevent data loss, the specifications of Linux ECSs that use LVM or RAID arrays cannot be modified.
  • A Xen ECS with more than 24 VBD disks attached cannot be changed to a KVM ECS.
  • A Xen ECS can be changed to a KVM ECS, but a KVM ECS cannot be changed to a Xen ECS.

Procedure

Figure 1 shows the flowchart for automatically changing a Xen ECS to a KVM ECS.
Figure 1 Flowchart for automatically changing a Xen ECS to a KVM ECS
Table 1 describes the operations for automatically changing a Xen ECS to a KVM ECS using a script.
Table 1 Procedure for automatically changing a Xen ECS to a KVM ECS using a script

Step

Description

1

Step 1: Back Up an ECS

2

Step 2: Use a Script to Automatically Install Drivers

3

Step 3: Modify Specifications

4

(Optional) Step 4: Check Disk Attachment

Step 1: Back Up an ECS

If you modify the specifications of an ECS without installing the driver, the ECS may become unavailable and the data on the system disk may be lost. You are advised to back up the ECS first to prevent data loss.

  1. Check the ECS.

    Before backing up the ECS, stop and then start the ECS to ensure that services can run properly after the ECS is started.

  2. Back up the ECS.
    Backing up ECSs generate storage costs. There are two types of EVS snapshots: standard snapshots and legacy snapshots. Legacy snapshots are in OBT and free of charge. Standard snapshots are billed. Select the one type as required.
    • Method 1: Create a backup for the ECS.

      For details, see ECS Backup Procedure.

    • Method 2: Create a system disk snapshot and a data disk snapshot.

      For details about how to create a snapshot, see Creating an EVS Snapshot in Elastic Volume Service User Guide.

Backups and snapshots created for the ECS are used to restore data. If the specifications fail to be modified, you can use the backups or snapshots to restore data.

After the specifications are modified, if services are running properly, delete the ECS backups or snapshots from the corresponding service console.

Step 2: Use a Script to Automatically Install Drivers

Use a script to install drivers on an ECS. If your ECS does not support configuration using a script, manually configure it by referring to Manually Changing a Xen ECS to a KVM ECS (Linux).

  1. Log in to the ECS.
  2. Run the following command to download the driver installation script to the root directory:

    curl URL > ~/resize_ecs_modify_linux.sh

    In the preceding command, URL is the address for downloading the specifications modification script.

    Select an address for downloading the optimization script based on the region where the ECS is located:

    URL for downloading the script: https://latin-server-resize.obs.na-mexico-1.myhuaweicloud.com/linux/server_resize/resize_ecs_modify_linux.sh

  3. Run the following command to execute the script which automatically checks and installs the native Xen PV driver and virtio driver:

    bash resize_ecs_modify_linux.sh

    Figure 2 Executing the script
  4. Wait until the script is executed.

    After checking that the required driver has been installed, the system automatically tags the ECS. The specifications of only the tagged ECSs can be modified.

    If the check result is "{Image name} already contain xen and virtio driver", the driver has been installed.
    • If the check result is "Success to set kvm meta!" or "this server already has kvm meta.", the ECS has been tagged. Then, go to Step 3: Modify Specifications.
    • If the check result is "Failed to set metadata, please try again.", tagging the ECS failed. In such a case, try again later.

    If the installation failed, manually configure the ECS by following the instructions provided in Manually Changing a Xen ECS to a KVM ECS (Linux) or contact customer service.

    Figure 3 Successful script execution

Step 3: Modify Specifications

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click . Under Compute, click Elastic Cloud Server.
  4. On the Elastic Cloud Server page, view the status of the target ECS.

    If the ECS is not in Stopped state, choose More > Stop in the Operation column.

  5. Choose More > Modify Specifications in the Operation column.

    The Modify ECS Specifications page is displayed.

  6. Select the new ECS type, vCPUs, and memory.
  7. (Optional) Set DeH.

    If the ECS is created on a DeH, you can change the DeH where the ECS resides.

    To do so, select the target DeH from the drop-down list. If no DeH is available in the drop-down list, it indicates that DeH resources are insufficient and cannot be used to create the ECS with new specifications.

  8. Select the checkbox to confirm that the configuration is complete.
  9. Click Next.
  10. Confirm the new specifications, read and agree to the agreement, and then click Submit Application.
    • The cloud platform automatically creates a system disk snapshot for you. After the specifications are modified, manually delete the snapshot on the snapshot page if you have verified that services are running properly.
    • If ECS specifications failed to be modified and the ECS becomes unavailable, reinstall the OS. This operation will clear the data on the system disk while the data on data disks is retained.

(Optional) Step 4: Check Disk Attachment

After a Xen ECS is changed to a KVM ECS, disk attachment may fail. Therefore, check disk attachment after specifications modification. If disks are properly attached, the specifications modification is successful.

Follow-up Procedure

If the ECS specifications have been modified but the OS cannot be started after remote login, contact customer service or reinstall the ECS OS to resolve this issue. For details, see Reinstalling the OS.

Reinstalling the OS will clear the system disk data, but the data on data disks is not affected.

After the specifications are modified, manually delete the snapshot on the snapshot page if you have verified that services are running properly.