You can replace the operating system of an Elastic Compute Service (ECS) instance by replacing its system disk. This topic describes how to use a non-public image such as a custom image to replace the operating system of an instance.
Prerequisites
- Snapshots are created to back up instance data to prevent data loss caused by the automatic release of the system disk to be replaced. For more information, see Create a snapshot for a disk.
- The instance whose operating system you want to replace is in the Stopped state. For information about how to stop an instance, see Stop an instance.
Warning When you stop a pay-as-you-go instance in a virtual private cloud (VPC), you must select Retain Instance and Continue Charging After Instance Is Stopped. If you select No Charges After Instance Is Stopped instead, you may not be able to start the instance after you replace its operating system.
Background information
This topic describes how to replace the operating system of a single instance in the ECS console. If you want to batch replace the operating systems of multiple instances, you can use the ACS-ECS-BulkyReplaceSystemDisk public template provided by Operation Orchestration Service (OOS). To learn more about the template, go to the OOS console.
For information about how to use a public image to replace the operating system of an instance, see Replace the operating system of an instance by using a public image. For information about image types, see Image overview.
Precautions
- When you replace the operating system of an instance, Alibaba Cloud assigns a new system disk to the instance. The system disk ID changes, and the original system disk is released. The category of the system disk, the IP addresses of the instance, and the MAC addresses of the elastic network interfaces (ENIs) bound to the instance remain unchanged.
- After you replace the operating system of an instance, you must redeploy environments on the new system disk to run services. This may interrupt the services that are running on the instance for an extended period of time.
- Snapshots of the original system disk cannot be used to roll back the new system disk,
but can be used to create custom images. Take note of the following items about the
snapshots based on their types:
- The manual snapshots of the original system disk are not automatically released.
- If Delete Automatic Snapshots While Releasing Disk is enabled for the original system disk, the automatic snapshots of the disk are automatically released along with the disk. If Delete Automatic Snapshots While Releasing Disk is not enabled for the original system disk, the automatic snapshots of the disk are not automatically released until they expire.
- If you want to make replacements between Windows Server and Linux operating systems,
take note of the following items:
- You can make replacements between Windows Server and Linux operating systems only within regions inside mainland China.
- Make sure that the hostname of the instance meets the requirements of the replacement operating system, and delete invalid characters. For information about how to modify the hostname, see Modify the properties of an instance or ModifyInstanceAttribute.
- If you want to replace the operating system to Windows Server, take note of the following
items:
- The system disk must have at least 1 GiB space reserved. Otherwise, the instance may not be able to start after the operating system is replaced.
- Microsoft no longer provides support for Windows Server 2003. To ensure your data security, we recommend that you do not use Windows Server 2003 for your instances. Alibaba Cloud no longer provides Windows Server 2003 images. For more information, see End of support for Windows Server 2003 public images.
Procedure
What to do next
- Redeploy environments on the new operating system to run services.
- If the new operating system is a Linux operating system and the instance has data disks attached, you must write the information of the data disk partitions to the /etc/fstab file and run the mount command to mount the partitions. For more information, see Configure UUIDs in the fstab file to automatically attach data disks.
- Optional. The automatic snapshot policy applied to the original system disk automatically becomes invalid, and you must configure an automatic snapshot policy for the new system disk. For more information, see Apply or disable an automatic snapshot policy.
- Optional. You can delete the snapshots of the original system disk that you no longer need. For more information, see Delete a snapshot.
FAQ
Question | Answer |
---|---|
How do I use the data disks of an instance after I replace its Linux operating system to Windows Server? | By default, Windows Server operating systems cannot recognize ext3, ext4, and xfs
file systems. We recommend that you perform one of the following operations on your
data disks:
|
How do I use the data disks of an instance after I replace its Windows Server operating system to Linux? | By default, Linux operating systems cannot recognize New Technology File System (NTFS)
file systems. We recommend that you perform one of the following operations on your
data disks:
|