Updated on 2025-12-03 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 1 to 4 minutes During this process, the ECS status is Changing OS.
  • Do not perform any operations on the ECS before the system injects the password or key, or 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.
  • An ISO image created from an ISO file cannot be used to change the OS of an ECS. You need to install an OS and drivers on the ECS and use the ECS to create a system disk image first.
  • The boot mode (BIOS or UEFI) cannot be changed.

Notes

After the OS is changed, the original OS and system disk will not be retained, and you need to deploy services in the new OS. This may interrupt your services for a long time. Therefore, read through the notes before changing an ECS OS.

Table 1 Notes

Resources and Environment

Impact After the OS Is Changed

OS

The original OS is not retained.

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.
    NOTE:

    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.

ECS size

No impact

System disk

  • The system disk capacity may increase because a different image is used.
  • The system disk type remains unchanged, but the system disk ID changes.
  • The original system disk is deleted, including the data in all partitions and all created snapshots of the system disk.

    Back up data before changing the OS. For details, see Backing Up an ECS.

Data disks

There are no impacts on data disks.

IP and MAC addresses

No impact

Custom settings (such as DNS and hostname)

Custom settings of the original OS will be reset. You need to configure them again.

Runtime status

The ECS with OS changed will be automatically started.

Service runtime environment

The service runtime environment must be deployed in the new OS again.

Billing Rules

The new system disk may have a larger capacity after an OS change, so you may be billed more.

Prerequisites

  • The data is backed up.

    For details, see Cloud Backup and Recovery.

  • If you want to change the login authentication mode from password to key pair during the OS change, create a key file in advance.

    For details, see (Recommended) Creating a Key Pair on the Management Console.

  • 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. Click in the upper left corner and select a region and project.
  3. Click . Under Compute, click Elastic Cloud Server.
  4. 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 Stop the ECS in the Change OS dialog box.

  5. Select the target image.
  6. Select the login mode.

    If the target ECS uses key pair authentication, you can replace the original key pair.

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

    After the application is submitted, the ECS status changes to Changing OS. When this status disappears, the OS change is complete.

    During the OS change process, a temporary ECS is created. After the OS change 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.

    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 fails, perform steps 3 to 8 again to retry the OS change.
  • If the attempt still fails, contact customer service for manual recovery at the backend.