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 desired 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 Type 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 installing drivers and configuring automatic disk attachment.
Constraints
- If a Linux ECS is attached with a logical LVM disk or a RAID disk array consisting of multiple physical disks, the ECS specifications cannot be modified. Otherwise, data may be lost.
- 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
Step 1: Create a System Disk Snapshot
Before modifying the specifications, back up the system disk by creating a system disk snapshot and install drivers on the ECS. Otherwise, once the ECS becomes unavailable after the modification, the data in the system disk may be lost.
For instructions 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 verify that services have been recovered.
Step 2: Using a Script to Automatically Install Drivers
Perform the operations described in this section if your ECS supports the configuration using a script. If your ECS does not support this mode, manually configure it. For details, see Manually Changing a Xen ECS to a KVM ECS (Linux).
- Log in to the ECS.
- 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:- CN East-Shanghai 2: https://cn-east-2-server-resize.obs.cn-east-2.myhuaweicloud.com/linux/server_resize/resize_ecs_modify_linux.sh
- CN North-Beijing 1: https://cn-north-1-server-resize.obs.cn-north-1.myhuaweicloud.com/linux/server_resize/resize_ecs_modify_linux.sh
- CN South-Guangzhou: https://cn-south-1-server-resize.obs.cn-south-1.myhuaweicloud.com/linux/server_resize/resize_ecs_modify_linux.sh
- 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
- Wait until the script is executed.
After checking that the desired driver has been installed, the system automatically tags the ECS. The specifications of only the ECSs with such a tag 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." is displayed, 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
- Make sure that the ECS has been configured successfully. Otherwise, the ECS will be unavailable after the modification is performed. If the operation failed, follow the instructions provided in Manually Changing a Xen ECS to a KVM ECS (Linux) for manual operations.
- FAQs related to a script installation failure:
Step 3: Modify Specifications
- Log in to management console.
- Click
in the upper left corner and select the desired region and project. - Under Computing, click Elastic Cloud Server.
- 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.
- Click More in the Operation column and select Modify Specifications.
The Modify ECS Specifications page is displayed.
- Select the new ECS type, vCPUs, and memory as prompted.
- (Optional) Set DeH.
If the ECS is created on a DeH, the system allows you to change the DeH.
To do so, select the target DeH from the drop-down list. If no DeH is available in the drop-down list, remaining DeH resources are insufficient and cannot be used to create the ECS with specifications modified.
- Select the check box to confirm the ECS configuration.
- 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 verify that services have been recovered.
- If modifying the ECS specifications failed and the ECS becomes unavailable, reinstall the OS to recover the ECS. However, this operation will clear the system disk data, and data disk data 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 with specifications modified is displayed in the ECS list but its OS cannot be started after the ECS is remotely logged in, contact customer service or reinstall the ECS OS to rectify this fault. For details, see Reinstalling the OS.
Reinstalling the OS will clear the system disk, but not affecting data disks.
After the specifications are modified, manually delete the snapshot on the snapshot page if you verify that services have been recovered.
Last Article: Changing a Xen ECS to a KVM ECS (Windows)
Next Article: Manually Changing a Xen ECS to a KVM ECS (Linux)

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.