You can replace the system disk if you select an incorrect OS when creating an ECS instance or you need to replace the current OS. The new system disk will be allocated a new ID, and the previous system disk ID will be released.
You can replace the image of the system disk with a public image, shared image, customized image, or any other image from the Alibaba Cloud Marketplace.
After you replace the system disk, note that:
- A new system disk with a new disk ID is allocated to your instance, and the original ID is released.
- The cloud type of the cloud disk cannot be replaced.
- The IP address and the MAC address remain unchanged.
- We recommend you delete snapshots or automatic snapshot policies to ensure sufficient snapshot quota for executing automatic snapshot policies of the new system disk.
This article describes how to replace an existing image with a public image. If you need to use a non-public image, see replace the system disk (non-public image).
Replacing the system disk exposes the system to multiple risks. Read the following precautions carefully before you begin:
The risks of replacing the system disk are as follows:
Replacing the system disk will stop your instances, which means your business services will be disrupted.
After replacing the system disk, you must redeploy the service running environment on the new system disk, which may result in a long interruption to services.
After you replace the system disk, a new system disk with a new disk ID will be assigned to your instance. This means that you cannot use snapshots of the original system disk to roll back the new system disk.Note After you replace the system disk, the snapshots you have manually created are not affected. You can still use them to create customized 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 no longer apply and all automatic snapshots of the original system disk will be automatically deleted.
Cross-OS disk replacement refers to replacing the system disk between Linux and Windows.
During cross-OS disk replacement, the file format of the data disk may be unidentifiable.
If 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.
If important data exists in your data disk, perform the following actions as required:
- From Windows to Linux, you must install a software application, for example, NTFS-3G, because NTFS cannot be identified by Linux by default.
- From Linux to Windows, you must install a software application, for example, Ext2Read or Ext2Fsd, because ext3, ext4, and XFS cannot be recognized by Windows by default.
If you replace Windows with Linux, use a password or an SSH key pair for authentication.
Make sure that there is sufficient system disk space. We recommend that you reserve 1 GiB in case the OS cannot properly start after system disk replacement.
If you want to replace the OS to Linux and use an SSH key pair for authentication, create an SSH key pair first.
Replacing the system disk may cause data loss or service interruption. To minimize impact to your business services, we recommend that you create snapshots for the original system disk before replacement.Note We recommend that you create snapshots during off-peak hours and plan for sufficient time. For example, to create a snapshot of 40 GiB for the first time, the process takes about 40 minutes. Additionally, creating a snapshot may reduce I/O performance of a block storage device by up to 10%.
To replace the system disk, follow these steps:
- Log on to the ECS console.
- In the left navigation pane, click Instances.
- Select the target region.
- In the Actions column of the target instance, select and follow the instructions in the prompt to stop the instance.
Note If the instance is a Pay-As-You-Go instance using a VPC with the No Fees for Stopped Instances function enabled, in the displayed Notes dialog box, click OK. In the displayed Stop dialog box, select Keep Stopped Instances and Continue Billing. If you select No Fees for Stopped Instances (VPC-Connected), the instance may not be properly started after system disk replacement.
- After the instance is stopped, in the Actions column, select .
- In the displayed dialog box, read the precautionary statement about system disk replacement and then click OK.
- On the Replace System Disk page, configure the following:
- Image Type: Select Public Image and then select the image version.
Note If you need to use a non-public image, see replace the system disk (non-public image).
- 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 space of the system disk you can configured is determined by the current disk space and image type.
Image Allowed range (GiB) Linux (excluding CoreOS) + FreeBSD 20-500 CoreOS 30-500 Windows 40-500Note If your instance has been configured with renewal for configuration downgrade, you cannot change the system disk space until the next billing cycle.
- Security enhancement:
If the new OS is Windows, you can only use a password for authentication.
If the instance is an I/O optimized instance, and the new OS is Linux, you can use either a password or an SSH key pair for authentication. In this case, we recommend you set a login password or bind an SSH key pair.
- Confirm Instance Cost, which includes the image fee and system disk fee. For more information about system disk price, see the pricing page of ECS.
- Check the configuration and click Confirm to change.
- Image Type: Select Public Image and then select the image version.
Log on to the ECS console to monitor the system status. It may take about 10 minutes to replace the OS and update the system status. After the OS is replaced, the instance automatically starts.
After replacing the system disk, you can perform the following operations:
(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 automatically fail. You need to configure automatic snapshot policies for the new system disk.
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. In this case, you need to write the new partition information into the /etc/fstab file of the new system disk and mount the partition, but do not need to partition or format the data disk for another time. The steps are described as follows. For more information about operation commands, see format and mount data disks for Linux instances.
- (Recommended) Back up the /etc/fstab file.
- Write information about the new partition into the /etc/fstab file.
- Check the information in the /etc/fstab file.
mountto mount the partition.
df-h -hto 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.