This topic was translated by AI and is currently in queue for revision by our editors. Alibaba Cloud does not guarantee the accuracy of AI-translated content. Request expedited revision

Replace the system disk (replace the operating system)

Updated at: 2025-01-15 06:12
important

This topic contains important information on necessary precautions. We recommend that you read this topic carefully before proceeding.

If you have selected an incorrect operating system when creating an ECS instance or if the current operating system no longer meets your business needs, you can replace the ECS instance's operating system. This process involves replacing both the image and the system disk. Follow the instructions in this topic to replace the operating system.

Prerequisites

  • Create a snapshot of the system disk to back up data.

    Important

    Replacing the operating system will result in the replacement of the system disk and the image. The original system disk will be released, and all data will be erased. Ensure you have created a snapshot of the system disk to back up data before proceeding with the operating system replacement. Snapshot creation may incur charges. For more information, see Snapshots.

  • The ECS instance must be in the Stopped state. If the instance is running, stop it first. For detailed instructions, see Stop an instance.

    Warning

    If an ECS instance uses the pay-as-you-go billing method and resides in a VPC, you must enable the standard mode when you stop the instance. If you enable the economical mode, you may be unable to start the instance after you replace the operating system of the instance.

  • For subscription ECS instances, they will be locked upon expiration. Renew the instance before replacing the operating system. For detailed instructions, see How to renew a subscription instance.

Scope of impacts

Replacing the operating system is a high-risk operation. It is important to understand the following points:

Important

After replacing the operating system, the data on the system disk will be erased. You will need to redeploy the business environment on the new system disk, which may lead to business interruptions. If you want to retain the data on the system disk and minimize business downtime, and if the original and target operating systems are compatible with migration and upgrade scenarios, consider using the Server Migration Center (SMC) for operating system migration. For more information, see Operating system migration and upgrade.

Item

Description

Item

Description

Impacts on the system disk

After replacement, Alibaba Cloud will assign a new system disk to your ECS instance:

  • The original system disk will be released, and its data and partition information will be erased.

  • The system disk ID will change, but the disk category, instance IP address, and elastic network interface (ENI) MAC address will remain the same.

Impacts on the data disk

  • If you replace the operating system within the same family, such as Windows to Windows or Linux to Linux: Only the system disk of the original instance is replaced. The data disk of the original instance is unaffected and must be reattached for use.

  • If you replace the operating system across families, such as Windows to Linux: In addition to replacing the system disk of the original instance, the data disk will need to be reinitialized or you must install software to recognize the file system format, as the file system format will not be recognized. For detailed instructions, see What to do next.

Important

If you use a custom image that includes a data disk to replace the operating system, ensure there are no dependencies between the system disk and the data disk that could affect your business processes. For instance, if your business involves read and write operations from the system disk to the data disk, replacing the operating system may cause issues with these operations due to changes in the system disk.

Impacts on snapshots

  • Snapshots of the original system disk cannot be used to roll back the new system disk, but they can be used to create custom images.

  • Manual snapshots of the original disk are not released.

  • For automatically created snapshots, if the Automatic Snapshot Release With Disk is enabled for the original system disk, the automatic snapshots are automatically deleted. If the Automatic Snapshot Release With Disk is not enabled, the snapshots are automatically released upon expiration.

  • The automatic snapshot policy of the original system disk will become invalid and needs to be reconfigured.

When replacing with a Windows operating system

  • The system disk must have at least 1 GiB of free space. Otherwise, the ECS instance may fail to start after the operating system is replaced.

  • Starting January 14, 2020, Microsoft no longer provide support for Windows Server 2008 and Windows Server 2008 R2. Starting October 10, 2023, Microsoft no longer provides support for Windows Server 2012 R2. Alibaba Cloud no longer provides technical support for ECS instances that run the preceding operating systems. If your ECS instances run the preceding operating systems, we recommend that you upgrade to Windows Server 2016 or later at the earliest opportunity. For more information, see Windows Server EOL guidance.

When replacing between Windows and Linux operating systems

  • Only regions in the Chinese mainland support this replacement. Non-Chinese mainland regions only support replacements within the same operating system family, such as Linux to Linux or Windows to Windows.

  • Ensure the hostname of the instance complies with the restrictions of the target system. For instance, a Windows system hostname cannot exceed 15 characters. For detailed instructions to modify the hostname, see Modify instance attributes or ModifyInstanceAttribute.

Costs

There is no charge for replacing the operating system itself. However, you may incur charges in the following scenarios:

  • If you use a paid image as the replacement image, you will be charged for the image. For more information, see image billing.

  • If you increase the system disk capacity during the replacement process, you will be charged for the additional disk space. For more information, see Elastic Block Storage billing.

Time required to replace the operating system

The operating system replacement process typically takes about 10 minutes. The actual duration may vary depending on the operating system. Please be patient.

Important

After the replacement is complete, VNC may not log on immediately due to slow system startup. Please wait and try again later.

Procedure

This section describes how to use an image to replace the operating system of a single ECS instance in the ECS console. If you need to perform batch operations, you can use the OOS public template ACS-ECS-BulkyReplaceSystemDisk to replace ECS system disks in batches. For more information, see ACS-ECS-BulkyReplaceSystemDisk.

  1. Navigate to the Replace Operating System page.

    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 the region where the ECS instance resides.image.png

    4. Locate the destination instance. In the Operation column, click Replace Operating System.

  2. Conduct a precheck on the operating system replacement.

    1. In the Replace Operating System dialog box, select Replace System Disk.

    2. The system will automatically perform a precheck on the operating system replacement, which takes about 10 seconds. Please wait patiently.

      • If the Precheck column shows image, the precheck is successful.

      • If the Precheck column shows image, the precheck has failed. Follow the on-screen instructions to resolve any issues before attempting to replace the operating system again.

    3. Read the precautions for replacing the operating system carefully, select I Am Aware Of The Above Risks And Confirm To Continue, and then click Continue To Replace Operating System.

  3. In the Replace Operating System dialog box, configure the new operating system information.

    • In the Select Image area, select the type and specific version of the image you want to use.

      Note

      Only image versions supported by the instance type can be replaced.

    • In the Security Settings area, set the logon authentication method.

      Logon Credential

      Description

      Logon Credential

      Description

      Key Pair

      Note

      Only Linux instances support logon authentication using key pairs.

      Select the username and existing key pair for instance logon, or click Create SSH Key Pair Create an SSH key pair. After creating the key pair, return to the Replace Operating System page and click the 刷新 button next to the key pair dropdown list to refresh the key pair list.

      The username can be set to root or ecs-user.

      Warning

      root is the highest-privileged account in the operating system. If you set Username to root, security risks may occur. We recommend that you set Username to ecs-user.

      Use Image Preset Password

      Note

      Only Custom Images and Shared Images support this authentication method.

      You can use the preset password of the selected image for logon authentication. To ensure normal use, verify that the selected image has a password preset.

      Custom Password

      Set the logon username and password. The username information is as follows:

      • Linux instances: The username can be set to root or ecs-user.

        Warning

        root is the highest-privileged account in the operating system. If you set Username to root, security risks may occur. We recommend that you set Username to ecs-user.

      • Windows instances: The default username is administrator.

      Post-replacement Settings

      After the replacement is complete, bind the key pair or reset the password when you remotely log on to the ECS instance. For more information, see Bind SSH Key Pair and Reset Instance Logon Password.

    • (Optional) In the System Disk area, adjust the system disk capacity or decide whether to encrypt the system disk according to your business needs.

      Important
      • You cannot switch to a different category of system disk.

      • You can increase the system disk capacity. Additional charges apply for the increased capacity. For more information, see Elastic Block Storage Billing.

      • If you opt to encrypt the system disk, the data stored on it will be encrypted for enhanced privacy and security. For more information, see Encrypt Disks.

  4. Review the cost details and click Replace Now.

  5. (Optional) Complete the payment process as prompted if there are fees associated with the replacement.

    Once the replacement is finished, verify that the status of the ECS instance in the instance list has changed to Running and that the Operating System type of the instance has been updated.

  6. (Conditionally required) If both the original and new operating systems are Linux and the data disk partitions are configured to automatically mount at startup, the mount information for the data disk partitions will be lost after the operating system switch. You will need to update the /etc/fstab configuration. For more information, see Configure Automatic Mounting of Data Disks by UUID in the fstab File.

What to do next

  • You will need to redeploy environments on the new operating system to resume services, which may include installing software, configuring APT or YUM repositories, and setting environment variables.

  • After replacing the operating system, the original system disk is released and the data is erased. You can create a new pay-as-you-go disk from a snapshot of the original system disk and attach it to the ECS instance to restore data. Once data restoration is complete, it is advisable to release the disk promptly. For more information, see create a disk from a snapshot, attach a data disk, and release a disk.

  • How do you reuse the data disks of an ECS instance after replacing the instance operating system between Windows and Linux operating system families?

    • After switching from a Linux to a Windows operating system, the Windows system may not recognize Ext3, Ext4, or XFS file systems by default. Depending on whether the data disks contain important data, you have a couple of options:

      • If the data disks do not contain important data, reinitialize them and format into a file system recognized by the Windows operating system. For more information, see reinitialize a data disk and initialize a data disk (Windows).

      • If the data disks contain important data, install software that enables the Windows operating system to recognize Ext3, Ext4, or XFS file systems, such as Ext2Read or Ext2Fsd.

    • After switching from a Windows to a Linux operating system, the Linux system may not recognize NTFS file systems by default. Depending on whether the data disks contain important data, you have a couple of options:

      • If the data disks do not contain important data, reinitialize them and format into a file system recognized by the Linux operating system. For more information, see reinitialize a data disk and initialize a data disk (Linux).

      • If the data disks contain important data, install software such as ntfsprogs to enable the Linux operating system to recognize NTFS file systems.

        When using ntfsprogs, execute the following commands in sequence to grant the Linux operating system access to NTFS file systems:

        yum -y install ntfs-3g
        mount -t ntfs-3g <data disk partition name> <mount directory>
        Note

        Modify <data disk partition name> and <mount directory> as per your specific requirements.

        For additional details, see how to mount an NTFS disk between Linux and Windows systems.

References

  • On this page (1)
  • Prerequisites
  • Scope of impacts
  • Procedure
  • What to do next
  • References
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare