This topic describes how to replace the system disk by using a public image.


We recommend that you replace the system disk in the following scenarios:
  • You selected an incorrect OS when creating an ECS instance.
  • You need to replace the current OS.
To replace the system disk, you can replace the disk image with a public image, shared image, custom image, or any other image found on the Alibaba Cloud Marketplace. This topic uses a public image as an example. If you need to use an image that is not a public image, see Replace the system disk (non-public image).

After you replace the system disk:

  • A new system disk with a new ID is allocated to your instance, and the original system disk is released.
  • The cloud disk type remains unchanged.
  • The IP address and the MAC address remain unchanged.
  • We recommend that you delete snapshots or automatic snapshot policies to ensure that you have sufficient snapshots available for the automatic snapshot policies of the new system disk.


Note Microsoft has ended extended technical support for Windows Server 2003. For data security purposes, we recommend that you discontinue running Windows Server 2003 on your ECS instances, and update the OS running on your instances. Alibaba Cloud no longer provides an image of this OS. For more information, see Offline announcement of Windows Server 2003 system image.

Replacing the system disk may involve the following risks:

  • The original system disk will be released. Therefore, we recommend that you create a snapshot to back up your data before replacing the system disk.

  • Your instance will be stopped and your services interrupted.

  • You must redeploy the service environment on the new system disk. However, this may result in an interruption to your services.

  • The disk ID will be changed. Therefore, snapshots of the original system disk cannot be used to roll back the new system disk.


    After you replace the system disk, the snapshots you have manually created are not affected. You can still use them to create custom images.

    If you have configured automatic snapshot policies for the original system disk to allow automatic snapshots to be released along with the disk, the snapshot policies will no longer apply. All automatic snapshots of the original system disk will be automatically deleted.

Precautions during cross-OS disk replacements

Cross-OS disk replacements refer to replacing the system disk from one OS to another, specifically a switch between Linux and Windows.

Note Regions outside Mainland China do not support disk replacements between Linux and Windows, but they do support disk replacements between different Linux or Windows editions.

During cross-OS disk replacements, the file format of the data disk may be unidentifiable.

  • In case no important data exists on the data disk, we recommend that you reinitialize the disk and format it to the default file system of your OS.

  • In case important data exists in your data disk, perform the following operations as required:

    • For switches from Windows to Linux, you must install a software application, such as NTFS-3G, because Linux cannot identify NTFS.
    • For switches from Linux to Windows, you also must install a software application, such as Ext2Read or Ext2Fsd, because Windows cannot identify ext3, ext4, or XFS.

Precautions during Windows OS replacements

  • Windows OS only supports password authentication.
    Note Linux OS supports password authentication and SSH key pair authentication. As a result, when you replace Windows OS with Linux OS on your instance, you will have more optional authentication methods.
  • If you are using a non-I/O-optimized instance, you can only replace your OS with the following Windows Server OSs by calling ReplaceSystemDisk.
    OS version Image ID
    Windows Server 2008 R2 Enterprise Edition (English) win2008r2_64_ent_sp1_en-us_40G_alibase_20170915.vhd
    Windows Server 2008 R2 Enterprise Edition (Chinese) win2008r2_64_ent_sp1_zh-cn_40G_alibase_20170915.vhd
    Windows Server 2012 R2 Datacenter Edition (Chinese) win2012r2_64_dtc_17196_zh-cn_40G_alibase_20170915.vhd
    Windows Server 2012 R2 Datacenter Edition (English) win2012r2_64_dtc_17196_en-us_40G_alibase_20170915.vhd
    Windows Server 2016 Datacenter Edition (Chinese) win2016_64_dtc_1607_zh-cn_40G_alibase_20170915.vhd
    Windows Server 2016 Datacenter Edition (English) win2016_64_dtc_1607_en-us_40G_alibase_20170915.vhd


  • Make sure that there is sufficient system disk space. We recommend that you reserve 1 GiB. Otherwise, the OS may not properly start after system disk replacement.

  • If you want to replace the OS to Linux and use an SSH key pair for authentication, you need to create an SSH key pair first.

  • System disk replacement may lead to data loss or service interruption. To minimize the impact on your services, we recommend that you create a snapshot for the original system disk during off-peak hours before starting the replacement process.

    Note Creating a snapshot of 40 GiB takes about 40 minutes the first time. Creating a snapshot may also reduce I/O performance of a block storage device by up to 10%.


To replace the system disk, follow these steps:

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the Actions column of the target instance, choose More > Instance Status > Stop and stop the instance as prompted.
    Note If the instance is a Pay-As-You-Go VPC instance with the No Fees for Stopped Instances function enabled, the instance may not be properly started after system disk replacement. We recommend that you disable this function when you stop the instance.
  4. From the Actions column, choose More > Disk and Image > Replace System Disk.
  5. In the displayed dialog box, read the precautionary statement about system disk replacement and then click OK.
  6. On the Replace System Disk page, set the following parameters:
    1. Image Type: Select Public Image and then select the image version.
    2. System Disk: Unchangeable. However, you can expand the disk space to meet the requirements of your system disk and services. The maximum disk space is 500 GiB. The minimum disk space you can configure depends on the current disk space and image type.
      Image Space range (GiB)
      Linux (excluding CoreOS) + FreeBSD [Max{20, current space of the system disk}, 500]
      CoreOS [Max{30, current space of the system disk}, 500]
      Windows [Max{40, current space of the system disk}, 500]
      Note If you have renewed your instance and downgraded the configurations, the system disk space cannot be changed until the next billing cycle starts.
    3. Security enhancement:
      • If the new OS is Windows, you can only use password authentication.

      • If the instance is an I/O optimized instance and the new OS is Linux, you can use a password or an SSH key pair for authentication. In this case, we recommend you set a logon password or bind an SSH key pair.

    4. Confirm Instance Cost, which includes the image fee and system disk fee. For more information, see the pricing page of ECS.
    5. Check your settings and click Confirm to change.

Replacing the OS and updating the system status take about 10 minutes. After the OS is replaced, the instance automatically starts.

What to do next

After replacing the system disk, perform the following operations as needed:

  • (Optional) Apply automatic snapshot policies to disks. Automatic snapshot policies are bound to the disk ID. After the system disk is replaced, automatic snapshot policies applied on the original disk will fail automatically. Therefore, you need to configure automatic snapshot policies for the new system disk.

  • Write the new partition information to the /etc/fstab file of the new system disk and mount the partition as follows:
    Note If the OS before and after disk replacement is Linux, and if a data disk is mounted to the instance and the partition is set to be mounted automatically at instance startup, then all mounting information will be lost. For more information, see Format and mount data disks for Linux instances.
    1. Back up the /etc/fstab file.
    2. Write information about the new partition to the /etc/fstab file.
    3. Check the information in the /etc/fstab file.
    4. Run the mount command to mount the partition.
    5. Run the df-h -h command to check the file system space and usage.

      After the data partition is mounted, the data disk is ready for use without the need for instance restart.

Related API