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 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 non-public image. If you need to use a public image, see replace the system disk (public image).
Replacing the system disk exposes the system to multiple risks. Read the following sections carefully before you begin:
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.
Before replacing the existing image with a non-public image, note the following:
If the target image is a custom image:
- If you want to use an image of a specified ECS instance, you must create a snapshot for the system disk of the specified instance and create a custom image using a snapshot. If the specified instance and the one whose system disk you want to change are located in different regions, you need to copy the images.
- To use a local physical image file, import it on the ECS console or use Packer to create and import the local image. The region where the image is located must be the same as that of your instance.
- To use an image in a region other than that of your instance, you must copy the image first.
Note Imported or duplicated images will be displayed in the Custom Image drop-down list.
To use an image owned by another Alibaba Cloud account, the account must first share the image .
If you want to replace the OS to Linux and use an SSH key pair for authentication, you must first create an SSH key pair.
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.
If you want to replace the OS to Linux, 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.
- 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.
The action is successful when the instance status 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 Custom Image, Shared Image, or Marketplace Image, and then select the image version.
- 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, set a login password or bind an SSH key pair.
- Confirm Instance Cost : includes the image fee and system disk fee. For more information, see the pricing page of ECS.
- Check the configuration and click Confirm to change.
Log on to the ECS console to monitor the system status. It may take about 10 minutes to replace the OS. 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.
Rf the OS before and after disk replacement is Linux before and after disk replacement, 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.