To replace the system disk, you need to assign a new system disk to the ECS instance. The original system disk is released and the system disk ID is updated. The disk category, instance IP address, and MAC address of the Elastic Network Interface (ENI) remain unchanged. If you want to use a different operating system or the current operating system is not suited to your requirements, you can replace the system disk to replace the operating system.

Prerequisites

  • After the system disk is replaced, the original system disk is released. We recommend that you create snapshots to back up disk data before you replace the system disk. For more information, see Create a snapshot.
    Note Create snapshots during off-peak hours to minimize the impact on your business. It takes about 20 to 40 minutes to create the initial snapshot of a 40 GiB system disk. We recommend that you plan ahead before creating a snapshot.
  • The instance is in the Stopped state. If the instance is not in the Stopped state, Stop an instance.
    Warning
    • Stopping an instance may interrupt the services running on the instance. Proceed with caution.
    • If the target instance is a pay-as-you-go instance and is in the No Fees for Stopped Instances (VPC-Connected) state, it may not be able to start after you replace the system disk. We recommend that you disable the No Fees for Stopped Instances (VPC-Connected) feature.

Background information

Replacing a system disk is a high-risk operation. Before you perform this operation, read and understand the following precautions:
  • Replacing the system disk requires stopping the instance, which causes the services running on it to stop.
  • You need to redeploy the service environment on the new system disk. Your services may be stopped for an extended period of time.
  • Snapshots of the original system disk cannot be used to roll back the new system disk.
  • Manual snapshots will not be released. You can use them to create custom images. If the Delete Automatic Snapshots While Releasing Disk feature is enabled on the original system disk, automatic snapshots will be released automatically.
  • For example, assume that the original and new operating systems are Linux systems, data disks are attached to the instance, and automatic partition mounting at system startup is enabled. After the system disk is replaced, the mounting configuration of the data disk partitions in the original system disk is lost. You need to manually update configurations in the /etc/fstab file. For more information, see What to do next.
  • If you want to replace the system disk between different operating system families, note that:
    • For regions outside mainland China, you cannot replace system disks between different operating system families. The system only supports replacement among different Linux distributions or among different Windows Server versions.
    • Make sure that the hostname of the instance meets the requirements of the target operating system, and delete invalid characters. For more information about how to modify the hostname, see Modify the properties of an instance or ModifyInstanceAttribute.
    • When you replace a Windows Server operating system with a Linux operating system, you can select an SSH key pair for authentication. For this step, you must have an existing SSH key pair. For more information, see Create an SSH key pair.
    • Linux systems with the default configuration do not recognize files in the NTFS format and Windows Server systems with the default configuration do not recognize files in ext3, ext4, or XFS format. You can select one of the following recommendations based on your data disks:
      • If the data disk does not contain important data, reinitialize the data disk and format it to the file system that is supported by the target operating system. For more information, see Reinitialize a data disk.
      • If the data disk contains important data, install system identifiers separately. For example, NTFS-3G (when Windows Server is replaced by Linux) or Ext2Read and Ext2Fsd (when Linux is replaced by Windows Server).
  • If you want to replace the operating system to Windows Server, note that:
    • The system disk must have at least 1 GiB space reserved. Otherwise, the ECS instance may not be able to start after the system disk is replaced.
    • Microsoft no longer offers support for Windows Server 2003. To ensure your data security, we recommend that you do not use Windows Server 2003 for your ECS instances. Alibaba Cloud no longer provides Windows Server 2003 images. For more information, see End of support for Windows Server 2003 public images.

In addition to replacing system disks one by one in the ECS console, you can also use the ACS-ECS-BulkyReplaceSystemDisk public template of OSS to replace multiple system disks at a time. For more information, go to the OOS console.

Procedure

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Find the target instance on the Instances page.
  5. In the Actions column, choose More > Disk and Image > Replace System Disk.
  6. In the message that appears, read the precautions for replacing the system disk, and click OK.
  7. On the Replace System Disk page, configure the following parameters:
    1. Image Type: Select Public Image and select an image version.
      For more information about how to replace an image of the system disk with a non-public image, see Replace the system disk (non-public images).
    2. System Disk: The category of the system disk cannot be changed. Configure the capacity of the system disk based on your business needs and the new image. The capacity must be greater than or equal to the current capacity of the system disk.
      The minimum disk capacity depends on the current disk capacity and the image type, while the maximum disk capacity is 500 GiB.
      Image Maximum capacity (GiB)
      CoreOS and FreeBSD Max {30, current capacity of the system disk} to 500
      Other Linux Max {20, current capacity of the system disk} to 500
      Windows Server Max {40, current capacity of the system disk} to 500
      Note If you have renewed and downgraded your instance, the system disk capacity cannot be modified until the start of the next billing cycle.
    3. Security enhancement:
      • Windows Server instances only support password authentication.If the operating system is Windows, you can only use the password for authentication.
      • If the instance is an I/O optimized instance and the operating system is Linux, you can use a password or an SSH key pair for authentication.Set a logon password or bind an SSH key pair.
    4. Read and select ECS Service Terms.
    5. Instance Cost: The fees of the image and the system disk are included. For more information about prices of the system disk, see Pricing.
    6. Confirm settings and click Confirm to Change.

Result

It takes about 10 minutes to replace the system disk. After the system disk is replaced, the instance automatically enters the Running state. Click the instance ID to go to the Instance Details page to view the replaced image.

What to do next

After the system disk is replaced, perform the following operations as needed:
  • Optional. After the system disk is replaced, automatic snapshot policies applied to the original disk automatically become invalid. Therefore, you need to configure automatic snapshot policies for the new system disk. For more information, see Apply or disable an automatic snapshot policy.
  • You need to ensure that you have enough snapshot quota to configure the automatic snapshot policies for the new system disk. You can delete the unneeded system disk snapshots of the original system disk. For more information, see Delete a snapshot.
  • Optional. Linux only: Write the new partition information to the /etc/fstab file of the new system disk and mount the partitions. Data disks do not need to be formatted and partitioned. You can perform the following steps. For more information about specific commands, see Format a data disk for a Linux-based ECS instance.
    1. Recommended. Back up the /etc/fstab file.
    2. Write the new partition information to the /etc/fstab file.
    3. View the new partition information in the /etc/fstab file.
    4. Run the mount command to mount the partitions.
    5. Run the df -h command to query the file system space and usage.

    After the partitions are mounted, you can use the data disks without restarting the instance.