Replace the system disk to switch to a different OS. To retain existing disk data, use OS migration instead.
Replacing the system disk is a disruptive operation that releases the original disk and causes a service interruption. All data on the disk is permanently deleted and cannot be recovered. Before proceeding, create a snapshot to back up your data.
Impacts
Replacing an OS is a high-risk operation. Be aware of the following impacts:
-
System disk
-
Data deletion: The original system disk is released, and all its data and partition information are permanently deleted.
-
ID change: The system assigns a new system disk, which changes the system disk ID.
-
Unchanged properties: The disk type, instance IP address, and elastic network interface (ENI) MAC address remain unchanged.
-
-
Data disks
-
Same OS family: If you replace an OS with another from the same OS family, for example, from Linux to Linux or from Windows to Windows, data disks are not affected. You only need to remount them after the replacement.
-
Cross-OS family: If you switch between Windows and Linux, by default, the new OS cannot recognize the file system on the original data disks. See Next steps for instructions on how to reinitialize the data disks or install specific software to read the data.
-
-
Snapshots
-
You cannot use snapshots of the original system disk to roll back the new system disk.
-
Manually created snapshots are retained.
-
The retention of automatic snapshots depends on whether the automatic snapshot release feature is enabled for the disk.
-
Enabled: Automatic snapshots are deleted.
-
Disabled: Automatic snapshots are released at the end of their lifecycle.
-
-
The automatic snapshot policy for the original system disk does not apply to the new one. You must reconfigure it.
-
-
Billing
The OS replacement feature is free of charge. However, costs are incurred in the following situations:
-
Paid image: If you select a paid image, you are charged according to its pricing.
-
System disk resize: If you increase the capacity of the system disk during the replacement, you are charged for the additional capacity.
-
Limitations
-
Region support: Switching between Windows and Linux is supported only in regions in the Chinese mainland. In other regions, you can replace an OS only with one from the same family, such as from Linux to Linux or from Windows to Windows.
-
Hostname: Before you perform a cross-family OS replacement, make sure that the instance hostname meets the requirements of the target OS. For example, a Windows hostname must contain 2 to 15 characters.
-
Non-I/O optimized instances: You can view the instance type in the Other Information section at the bottom of the instance details page. If the instance is non-I/O optimized, you cannot use the console to replace its OS with a Windows OS. You can only call the ReplaceSystemDisk API operation to switch to one of the following public Windows Server images.
-
Target system disk capacity: When you replace the OS with a Windows OS, the system disk must have at least 1 GiB of free space. Otherwise, the instance will not start after the replacement.
-
Image limitations: Instances that run Alibaba Cloud Linux 3 Pro do not support replacement with another OS.
Procedure
-
Go to the ECS console - Instances. In the top navigation bar, select the region and resource group where the target instance is located.
-
On the Instances page, click the ID of the target instance to go to its details page. In the upper-right corner, choose All Operations > Replace System Disk.
-
Set the OS replacement method.
-
Set Replacement Method to Replace a system disk. The system automatically runs a precheck. If the precheck fails, fix the issues as prompted on the page and then try again.
-
Read the notes carefully, select the checkbox for I am aware of the preceding risks and want to continue, and then click Continue to Replace Operating System.
-
-
Configure the new OS and instance settings.
-
Image: Select an image type, such as Public Image or Custom Image, and a specific image version compatible with the current instance type.
-
Security Settings:
Parameter
Description
Key Pair
(Linux instances only) Select an existing key pair. If no key pairs are available, click Create Key Pair to create a new one.
Use Predefined Password
(Custom or shared images only) Use the image's preset password for logon. Ensure the selected image has a configured password.
Password
Set a logon username and password for the new system. For a Linux system, you can set the username to
rootorecs-user(recommended). For a Windows system, the username isadministratorby default.Set after Change
Skip the logon credential settings. After the OS is replaced, you must bind an SSH key pair or reset the instance logon password before you can log on to the instance.
-
System Disk (Optional): You can increase the capacity of the system disk or enable the disk encryption feature as needed. The system disk type cannot be changed.
For information about the fees for increasing system disk capacity, see Block storage billing.
-
-
Confirm the configurations and fees, and then start the OS replacement.
-
(Conditionally required) If the instance is Running, stop the instance.
-
Subscription: If you increase the system disk capacity during the OS replacement, you must complete the payment as instructed. The replacement process begins only after the payment is complete.
-
Pay-as-you-go: We recommend that you select Standard Mode when you stop the instance. If you use Economical Mode, the instance may not start after the OS replacement due to insufficient inventory.
-
The replacement process takes about 10 minutes, during which the instance automatically restarts. After the process is complete, the instance status changes to Running, and your selected OS is installed.
Next steps
-
(Conditionally required) Manage data disks
-
Same OS family: If you replace a Linux OS with another and the instance has data disks, you must log on to the instance and mount the file systems of the data disks after the replacement.
-
Cross-OS family:
-
Linux to Windows: Windows does not natively recognize file systems such as ext4 and XFS. Use a third-party tool such as
Ext2Fsdto read the data disk, or reinitialize the data disk if it does not contain important data. -
Windows to Linux: Linux does not natively recognize the NTFS file system. You can install the ntfs-3g tool to mount the file system, or reinitialize the data disk if it does not contain important data.
-
-
-
(Optional) Recover data from the original system disk: If you need to recover data from the original system disk, you can use a snapshot of the original system disk to restore data. Create a new pay-as-you-go disk from the snapshot you created before the replacement, and attach it to the instance to recover the data. After you finish the recovery, release the disk promptly to avoid unnecessary charges.
-
(Optional) Extend the system disk partition and file system
If you increase the system disk's capacity while replacing the OS, the partition extension may fail due to a timeout. If the partition does not extend automatically, you must extend it manually by following the instructions in Extend partitions and file systems of a disk (Linux). This method only extends the partition and does not affect the OS version.
-
Redeploy your environment: On the new OS, reinstall required software, configure environment variables, and migrate your applications and data.
Related operations
-
Configure an automatic snapshot policy for a disk to create automatic backups at regular intervals.
-
After you confirm that the data on the original system disk is no longer needed, delete the snapshot to reduce storage costs.
-
Use the public template ACS-ECS-BulkyReplaceSystemDisk to replace system disks for multiple ECS instances in bulk.
-
Use the ReplaceSystemDisk API operation to replace an OS.
-
Which operating systems support a graphical user interface (GUI).