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 2024-10-18 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 ECSs include S1, C1, C2, and M1 ECSs.
  • To obtain KVM ECSs, 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 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

Operation

1

Step 1: Create a System Disk Snapshot

2

Step 2: Use a Script to Automatically Install Drivers

3

Step 3: Modify Specifications

4

(Optional) Step 4: Check Disk Attachment

Step 1: Create a System Disk Snapshot

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. Therefore, create a snapshot for the system disk first.

  1. Before you create a system disk snapshot, check the ECS.

    Stop and then start the ECS to ensure that services can run properly after the ECS is started.

  2. For details about how to create a system disk snapshot, see Creating a Snapshot in Elastic Volume Service User Guide.

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

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 your 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, click More in the Operation column and select Stop.

  5. Click More in the Operation column and select Modify Specifications.

    The Modify ECS Specifications page is displayed.

  6. Select the new ECS type, vCPUs, and memory as prompted.
  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 specifications modified.

  8. Select the check box to confirm that the configuration is complete.
  9. Click OK.
    • 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 not affected.

(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.