Updated on 2024-07-24 GMT+08:00

Changing the OS

Scenarios

Changing an ECS OS will change the system disk attached to the ECS. After the change, the system disk ID of the ECS will be changed, and the original system disk will be deleted.

If the OS running on an ECS cannot meet service requirements, change the ECS OS.

The cloud platform supports changing between image types (public images, private images, and shared images) and between OSs. You can change your OS by changing your ECS image.

Constraints

  • The OS change takes about 10 to 20 minutes During this process, the ECS status is Changing OS.
  • Do not perform any operations on the ECS before the system injects the password. Otherwise, the login will fail.
  • The target ECS must have a system disk attached.
  • The EVS disk quota must be greater than 0.
  • The system disk type cannot be changed.
  • H2 ECSs do not support OS change.

Notes

  • After the OS is changed, the original OS is not retained, and the original system disk is deleted, including the data in all partitions of the system disk.
  • Back up data before changing the OS.
  • Changing the OS does not affect data in data disks.
  • After the OS is changed, your service running environment must be deployed in the new OS again.
  • After the OS is changed, the ECS will be automatically started.
  • After the OS is changed, the system disk type of the ECS cannot be changed.
  • After the OS is changed, the IP and MAC addresses of the ECS remain unchanged.
  • After the OS is changed, customized configurations, such as DNS and hostname of the original OS will be reset and require reconfiguration.
  • It takes about 10 to 20 minutes to change the OS. During this process, the ECS is in Changing OS state.
  • The system disk capacity of an ECS with OS changed may change because the system disk capacity specified by the image of the changed OS may be changed.

Notes on Change Between Windows and Linux

When you change the OS from Windows to Linux or from Linux to Windows, note the following:

  • To change Windows to Linux, install an NTFS partition tool, such as NTFS-3G for data reads and writes on the Windows ECS.
  • To change Linux to Windows, install software, such as Ext2Read or Ext2Fsd to identify ext3 or ext4.

    If there are LVM partitions on the Linux ECS, these partitions may fail after the OS is changed to Windows. Therefore, a change from Linux to Windows is not recommended.

Prerequisites

  • The data is backed up.

  • If you plan to use a private image to change the OS, ensure that a private image is available. For details about how to create a private image, see Image Management Service User Guide.
    • If the image of a specified ECS is required, make sure that a private image has been created using this ECS.
    • If a local image file is required, make sure that the image file has been imported to the cloud platform and registered as a private image.
    • If a private image from another region is required, make sure that the image has been copied.
    • If a private image from another user account is required, make sure that the image has been shared with you.

Procedure

  1. Log in to the management console.
  2. Under Computing, choose Elastic Cloud Server.
  3. Locate the row containing the target ECS and choose More > Manage Image/Disk > Change OS in the Operation column.

    Before changing the OS, stop the ECS first or select Automatically stop the ECSs and change their OSs.

    ECS OSs can be changed in a batch. To do so, perform the following operations:

    1. Select the target ECSs.
    2. Click More above the ECS list and select Change OS from the drop-down list.
  4. Select the target image.

    For more details, see Creating an ECS.

  5. Configure the login mode.

    When using a private image to change the OS, you can use the private image password.

  6. Click OK.
  7. In the Change OS dialog box, confirm the specifications, and click OK.

    After the application is submitted, the status Changing OS is displayed. When this status disappears, the OS change is complete.

    A temporary ECS is created during the OS change process. After the process is complete, this ECS will be automatically deleted.

Follow-up Procedure

  • If the OSs before and after the OS change are both Linux, and automatic mounting upon system startup has been enabled for data disks, the data disk partition mounting information will be lost after the OS is changed. In such a case, you need to update the /etc/fstab configuration.
    1. Write the new partition information into /etc/fstab.

      It is a good practice to back up the /etc/fstab file before writing data into it.

      To enable automatic partition mounting upon system startup, see Initializing a Linux Data Disk (fdisk).

    2. Mount the partition so that you can use the data disk.

      mount Disk partition Device name

    3. Check the mount result.

      df -TH

  • If the OS change is unsuccessful, perform steps 2 to 7 again to retry the OS change.
  • If the second OS change attempt is unsuccessful, contact the administrator for manual recovery.