• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. User Guide
  4. Configuration Modifications
  5. Modifying ECS vCPU and Memory Specifications
  6. Changing a XEN ECS to a KVM ECS (Linux)

Changing a XEN ECS to a KVM ECS (Linux)

Scenarios

A Linux ECS can be switched from XEN to KVM if xen-pv and virtio drivers run on the ECS. Before changing a XEN ECS to a KVM ECS, ensure that the required drivers have been installed and the UUID has been configured on the ECS.

This section describes how to manually configure a Linux ECS for changing XEN to KVM.

Constraints

  • 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.
  • General-purpose ECSs and memory-optimized ECSs can be exchanged (only from XEN to KVM if the virtualization type is changed), as shown in Table 1.
    Table 1 ECS types supporting change from XEN to KVM

    -

    S2

    C3

    M2

    M3

    S1

    Supported

    Supported

    Supported

    Supported

    C1

    Supported

    Supported

    Supported

    Supported

    C2

    Supported

    Supported

    Supported

    Supported

    M1

    Supported

    Supported

    Supported

    Supported

    H1

    Supported

    Supported

    Supported

    Supported

    For example, an S1 ECS can be changed to an S2, C3, M2, or M3 ECS.

Procedure

Figure 1 shows the process of changing a XEN ECS to a KVM ECS.
Figure 1 Process of changing a Linux ECS from XEN to KVM

In the preceding figure:

1: indicates that the ECS is automatically configured using a script. The OSs supporting automatic script operations are as follows:
  • Ubuntu 14.04
  • Ubuntu 16.04
  • CentOS 6.7
  • CentOS 6.8
  • CentOS 7.1
  • CentOS 7.2
  • CentOS 7.3
  • CentOS 7.4
  • EulerOS
  • SUSE 11
Table 2 describes the operations for these OSs.
Table 2 Procedure for changing a XEN ECS to a KVM ECS using a script

Step

Operation

1

(Optional) Backing Up the System Disk

2

Automatically Configuring the ECS Using a Script

3

Modifying Specifications

4

Checking Disk Attachment

2: indicates that the ECS is manually configured. If your ECS does not support the configuration using a script, manually configure the ECS. Table 3 describes the operations.

(Optional) Backing Up the System Disk

Before modifying the specifications, back up the system disk and install the driver on the ECS. Otherwise, the ECS will be unavailable after the modification is performed. If the ECS becomes unavailable, the fault can be rectified by reinstalling the OS, which may cause data loss in your system disk.

For instructions about how to back up the system disk, see section "Getting Started > Creating a VBS Backup" in Volume Backup Service User Guide.

Automatically Configuring the ECS Using a Script

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 Configuring the ECS.

NOTE:

For details about the ECSs supporting the configuration using a script, see Procedure.

  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.

    URL: https://ecs-instance-driver.obs.eu-de.otc.t-systems.com/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 execution is complete. If the message "{Image name} already contain xen and virtio driver" is displayed, the driver has been installed.

    Perform the operations described in section Modifying Specifications. Otherwise, execute the script again or contact customer service for technical support.

    Figure 3 Successful script execution

    Ensure that the ECS is configured successfully. Otherwise, the ECS will be unavailable after the modification is performed.

Manually Configuring the ECS

Perform the operations described in this section if your ECS does not support the configuration using a script.

  1. Log in to the ECS.
  2. Uninstall Tools from the ECS.

    For details, see section Uninstalling Tools from a Linux ECS.

  3. Change the GRUB disk ID to UUID.

    For details, see section Changing the Disk Identifier of the GRUB Configuration File to UUID.

  4. Change the fstab disk ID to UUID.

    For details, see section Changing the Disk Identifier of the fstab File to UUID.

  5. Install native XEN and KVM drivers.

    For details, see section Installing Native XEN and KVM Drivers.

(Optional) Verifying the ECS Configuration

Perform the following operations to check whether the configuration files have been modified and the drivers have been installed:

  1. Log in to the ECS.
  2. Run the following command to check whether the root partition is in UUID format:

    cat /boot/grub/grub.cfg

    • If yes, the disk ID in the GRUB configuration file has been changed to UUID.
    • If no, the modification failed. In such a case, change the GRUB disk ID to UUID again.
    ...menuentry 'Ubuntu Linux, with Linux 3.13.0-24-generic' --class ubuntu --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.13.0-24-generic-advanced-ec51d860-34bf-4374-ad46-a0c3e337fd34' {
    recordfail
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_msdos
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root ec51d860-34bf-4374-ad46-a0c3e337fd34
    else
    search --no-floppy --fs-uuid --set=root ec51d860-34bf-4374-ad46-a0c3e337fd34
    fi
    echo 'Loading Linux 3.13.0-24-generic ...'
    linux /boot/vmlinuz-3.13.0-24-generic root=UUID=ec51d860-34bf-4374-ad46-a0c3e337fd34 ro
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-3.13.0-24-generic
    }
    NOTE:

    The path in which the GRUB configuration file is stored varies depending on the OS. For example, the path can be /boot/grub/menu.lst, /boot/grub/grub.cfg, /boot/gurb2/grub.cfg, or /boot/grub/grub.conf.

  3. Run the following command to check whether the disk ID in the fstab configuration file is UUID:

    cat /etc/fstab

    • If yes, the disk ID has been changed to UUID.
    • If no, the modification failed. In such a case, change the fstab disk ID to UUID again.
    [root@****** ~]# cat /etc/fstab 
    UUID=4eb40294-4c6f-4384-bbb6-b8795bbb1130  /       xfs     defaults    0 0
    UUID=2de37c6b-2648-43b4-a4f5-40162154e135  swap    swap    defaults    0 0
  4. Check whether the native XEN and KVM drivers have been installed.
    • If the boot virtual file system is initramfs, run the following commands:

      lsinitrd /boot/initramfs-`uname -r`.img | grep xen

      lsinitrd /boot/initramfs-`uname -r`.img | grep virtio

    • If the boot virtual file system is initrd, run the following commands:

      lsinitrd /boot/initrd-`uname -r` | grep xen

      lsinitrd /boot/initrd-`uname -r` | grep virtio

    If the names of the native XEN and KVM drivers are displayed in the command output, the drivers have been installed.

    [root@CTU10000xxxxx home]# lsinitrd /boot/initramfs-`uname -r`.img | grep xen 
    -rwxr--r--   1 root     root        54888 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/block/xen-blkfront.ko 
    -rwxr--r--   1 root     root        45664 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/net/xen-netfront.ko 
     
    [root@CTU10000xxxxx home]# lsinitrd /boot/initramfs-`uname -r`.img | grep virtio 
    -rwxr--r--   1 root     root        23448 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/block/virtio_blk.ko 
    -rwxr--r--   1 root     root        50704 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/net/virtio_net.ko 
    -rwxr--r--   1 root     root        28424 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/scsi/virtio_scsi.ko 
    drwxr-xr-x   2 root     root            0 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio 
    -rwxr--r--   1 root     root        14544 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio.ko 
    -rwxr--r--   1 root     root        21040 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio_pci.ko 
    -rwxr--r--   1 root     root        18016 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio_ring.ko

Ensure that the ECS is configured successfully. Otherwise, the ECS will be unavailable after the modification is performed.

Modifying Specifications

  1. Log in to management console.
  2. Click in the upper left corner and select the desired region and project.
  3. Under Computing, 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, 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.

  8. Select the check box to confirm the ECS configuration.
  9. Click OK.

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

  1. Log in to the ECS as user root.
  2. Run the following command to view the disks attached before specifications modification:

    fdisk -l | grep 'Disk /dev/'

    Figure 4 Viewing disks attached before specifications modification

    As shown in Figure 4, the ECS has three disks attached: /dev/vda, /dev/vdb, and /dev/vdc.

  3. Run the following command to view disks attached after specifications modification:

    df -h| grep '/dev/'

    Figure 5 Viewing disks attached after specifications modification

    As shown in Figure 5, only one disk /dev/vda is attached to the ECS.

  4. Check whether the number of disks obtained in 2 is the same as that obtained in 3.
    • If yes, the specifications have been modified. No further action is required.
    • If no, the disk attachment failed. In such a case, go to 5.
  5. Run the mount command to attach the affected disks.

    An example is provided as follows:

    mount /dev/vbd1 /mnt/vbd1

    In the preceding command, /dev/vbd1 is the disk to be attached, and /mnt/vbd1 is the path for disk attachment.

    Ensure that /mnt/vbd1 is empty. Otherwise, the attachment will fail.

  6. Run the following commands to check whether the numbers of disks before and after specifications modification are the same:

    fdisk -l | grep 'Disk /dev/'

    df -h| grep '/dev/'

    • If yes, no further action is required.
    • If no, contact customer service.
    Figure 6 Checking the number of disks attached

    As shown in Figure 6, the numbers of disks before and after specifications modification are the same. The disks are /dev/vda, /dev/vdb, and /dev/vdc.

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, reinstall the ECS OS to rectify this fault. For details, see section Reinstalling the OS.