Operating system migration (Linux)

Updated at:
Copy as MD

When your ECS instance's operating system reaches end of life (EOL) or needs an upgrade, use Server Migration Center (SMC) to migrate it in place while retaining all system disk data. Supported sources: CentOS 7/8, Red Hat 7/8, and Alibaba Cloud Linux 2.

Note

Migration from CentOS 7/8 to Red Hat 7/8 using SMC is currently available to select users only. To request access, submit a ticket.

Background

An EOL operating system (Overview of operating system lifecycles) poses increased security and operational risks. SMC provides migration solutions that convert and upgrade the OS kernel and major system packages in place while retaining system disk data.

Note

If you do not need to retain system disk data or need more OS conversion options, use the Replace the system disk feature instead.

Migration paths

CentOS 7/8

Architecture

Source

Destination

x86

CentOS 7.x

  • AnolisOS 7

  • AnolisOS 8

  • Alibaba Cloud Linux 2

  • Alibaba Cloud Linux 3

  • Red Hat 7

    Note

    Migration from CentOS 7.9 to Red Hat 7 is available only to select users. To use this feature, .

CentOS 8.x

  • AnolisOS 8

  • Alibaba Cloud Linux 3

  • Red Hat 8

    Note

    Migration from CentOS 8.5 to Red Hat 8 is available only to select users. To use this feature, .

ARM64

CentOS 7.x

  • AnolisOS 7

  • AnolisOS 8

  • Alibaba Cloud Linux 3

CentOS 8.x

  • AnolisOS 8

  • Alibaba Cloud Linux 3

Red Hat 7/8

Architecture

Source

Destination

x86

Red Hat 7.9

  • Alibaba Cloud Linux 3

  • Red Hat 8

    Note

    You cannot specify a minor version for the destination Red Hat operating system.

Red Hat 8.x

  • Red Hat 9

    Note

    You cannot specify a minor version for the destination Red Hat operating system.

  • Alibaba Cloud Linux 3

Alibaba Cloud Linux 2

Architecture

Source

Destination

x86

Alibaba Cloud Linux 2

Alibaba Cloud Linux 3

Migration limitations

Category

Description

General limitations

  • Anolis OS and Alibaba Cloud Linux do not provide i686-architecture packages. If your CentOS system has i386-architecture packages (including i686) installed, migration is blocked. Migration limitations for features or software.

  • The migration tool downloads and installs packages. Ensure the instance has the following available resources:

    • Memory: 600 MiB

    • Cloud disk capacity:

      • The /usr directory requires 250 MiB.

      • The /var directory requires 4 GiB.

      • The /boot directory requires 100 MiB.

    Note

    If the instance has limited compute or storage resources, stop running services before migration to prevent resource-related failures.

  • Only specific migration solutions are supported.

  • You cannot migrate the operating system while a snapshot is being created for the instance. Wait for the snapshot creation to finish before you start the migration.

Migrate from CentOS 7 to Alibaba Cloud Linux 2

Alibaba Cloud Linux 2 uses kernel 4.19, which is not compatible with the CentOS 7 kernel 3.10. Workloads that depend on kernel interface programming (such as OOT kernel module development or hardware enablement) require pre-migration evaluation.

Migrate from CentOS 7 to Alibaba Cloud Linux 3

Alibaba Cloud Linux 3 uses kernel 5.10 LTS with GCC 10.2, binutils 2.35, and glibc 2.32 as its toolchain, which is not compatible with the CentOS 7 kernel 3.10. Workloads that depend on kernel interface programming (such as OOT kernel module development or hardware enablement) require pre-migration evaluation.

Migrate from CentOS 8 to Alibaba Cloud Linux 3

Alibaba Cloud Linux 3 uses kernel 5.10 LTS with GCC 10.2, binutils 2.35, and glibc 2.32. Its package ecosystem is compatible with CentOS 8. The migration tool performs a basic check on the source OS before proceeding.

Additional migration limitations for specific features or software:

Feature or software

Support status

Affects migration

Description

i386-architecture packages

Not supported

Yes

Alibaba Cloud Linux does not provide i386-architecture packages. Remove all i386 packages from your CentOS 7/8 system before migration.

epel-modular

Not supported

No

The EPEL repositories in CentOS 7/8 and Alibaba Cloud Linux 3 depend on different platforms. Migration proceeds, but epel-modular-based packages cannot be installed after migration.

C/C++ program compatibility

Not guaranteed

No

Alibaba Cloud Linux 3 uses GCC 10.2, binutils 2.35, and glibc 2.32. Recompile and verify your C/C++ programs with the new toolchain after migration.

Kernel module compatibility

Not supported

No

Alibaba Cloud Linux 3 uses kernel 5.10 LTS and is package-compatible with CentOS 8, but not fully compatible with the CentOS 7 kernel 3.10 or CentOS 8 kernel 4.18. Workloads that depend on kernel interface programming (such as OOT kernel module development or hardware enablement) require a migration assessment.

MySQL database

Migration is supported only to the same or a later version of MySQL.

  • Migrating to the same or a later MySQL version has no effect.

  • Migrating to an earlier version of MySQL blocks the process.

Alibaba Cloud Linux 3 supports MySQL, but MySQL does not support downgrades. If the destination MySQL version is older than your source version, migration is blocked.

Hot migration

Not supported

No

OS migration reinstalls packages and restarts services, causing downtime. Before migrating, create a snapshot to back up data and isolate the source environment.

Migration considerations

Important

Review these considerations before migration.

Migration phase

Considerations

Before migration

  • Complete the preparations. For more information, see Preparations.

  • Review the migration limitations and test all applications on the destination OS to ensure compatibility.

  • During the migration, the source instance's system kernel and software packages are installed or updated, and the instance automatically restarts multiple times. Your services will be unavailable during this period. We recommend that you assess the potential impact and stop your services before you start the migration.

During migration

  • During the migration, do not stop, restart, or release the ECS instance, either manually or by using O&M scripts. Otherwise, the migration may fail.

  • A migration drill or a migration cancellation may trigger an automatic rollback of the pre-migration snapshot, resulting in the loss of any data generated during the migration.

  • The migration process performs several operations on the ECS instance, such as creating a snapshot, converting the operating system kernel version, reinstalling and upgrading software packages, and stopping and starting the instance. We recommend that you back up important data and schedule a suitable migration window in advance to prevent these operations from affecting your business.

  • The system checks prerequisites and performs a pre-migration assessment. If any check fails, migration stops with an error. A successful migration is not guaranteed. Review prerequisites and run tests in advance. For troubleshooting, see Operating system migration issues (Linux) and Red Hat official documentation for troubleshooting migration issues.

After migration

  • After the migration, the instance automatically starts. The instance ID, image ID, VPC, public and private IP addresses, hostname, and machine fingerprint remain unchanged. The operating system of the instance is changed to the target operating system.

  • The data on the original system disk remains unchanged, but your applications may not run properly due to changes in the environment or dependencies. This may cause your services to fail. Therefore, you must perform thorough testing and verification.

Billing

The system creates snapshots of all cloud disks during migration, which incur pay-as-you-go charges. Product billing.

Procedure

Important

The system creates snapshots of all disks during migration. You are charged for these snapshots on a pay-as-you-go basis. Product billing.

  1. (Conditional) To migrate CentOS 7/8 to Red Hat 7/8, complete the following steps. Otherwise, skip this step.

    1. If the Security Center client is installed on the source system, uninstall it first.

      Note

      Reinstall the client after migration. Install the client.

      1. Go to the Alibaba Cloud Security Center client uninstallation page and select the target instance. Uninstall the client.

      2. Connect to the server and run the following command.

        wget "http://update2.aegis.aliyun.com/download/uninstall.sh" && chmod +x uninstall.sh && ./uninstall.sh
        if ! lsmod | grep AliSecGuard; then echo 'Uninstall Success'; else echo "Uninstall Failed"; fi

        A return message of Uninstall Success indicates that the Security Center client has been successfully uninstalled.

    2. Run the following command to upgrade the source system to the latest kernel version.

      CentOS 7

      # Back up the original yum repo and update to the Alibaba Cloud CentOS 7 repo.
      mv /etc/yum.repos.d/ /etc/yum.repos.d.backup/
      mkdir -p /etc/yum.repos.d/
      wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
      wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
      yum clean all
      yum makecache
      # Update and restart the system.
      yum -y update
      reboot

      CentOS 8

      # Back up the original yum repo and update to the Alibaba Cloud CentOS 8 repo.
      mv /etc/yum.repos.d/ /etc/yum.repos.d.backup/
      mkdir -p /etc/yum.repos.d/
      wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.aliyuncs.com/repo/Centos-8.repo
      wget -O /etc/yum.repos.d/epel-archive-8.repo http://mirrors.cloud.aliyuncs.com/repo/epel-archive-8.repo
      yum clean all
      yum makecache
      # Update and restart the system.
      yum -y update
      reboot
  2. Migrate the operating system.

    Fast migration

    Note

    If your instance was purchased before December 1, 2017, created from a custom image that you uploaded, or is a third-party cloud server, you must install the Cloud Assistant Agent on the ECS instance to use this method. ECS instances created from public images after December 1, 2017 have the required Cloud Assistant Agent pre-installed by default. You can ignore this note.

    1. Go to the Operating System Migration page in the SMC console.

    2. On the OS Migration page, click Start Migration.

    3. In the OS Migration dialog box, select the ECS instance to migrate by its instance ID and region, and then click Pre-check.

    4. In the OS Migration dialog box, the system automatically performs a pre-check. The check takes about 10 seconds.

      • If the pre-check status changes from image to image, the pre-check is successful.

      • If the pre-check status changes from image to image, the pre-check failed. Follow the on-screen instructions to resolve the issue and then try again.

    5. Carefully read the notes for operating system migration, select I acknowledge and accept these risks and authorize Alibaba Cloud to create snapshots for all disks on the instance., and then click Next.

      Confirm that the Pre-check result for the instance is Ready.

    6. In the Operating System dialog box, select a target operating system as needed.

      • Migrate to the same target operating system: If you perform a batch migration, you can migrate multiple instances to the same operating system.

      • Select a target operating system for each instance: If you perform a batch migration, you can migrate multiple instances to different operating systems as needed.

    7. Click Check Migratability to view the migration check result.

      The check takes about 30 seconds.

      • image: The operating system can be migrated.

      • image: The operating system cannot be migrated. Follow the on-screen instructions to view the reason.

    8. Click Migrate.

      View the progress of the operating system migration on the OS Migration page.

      Warning

      During the operating system migration, do not manually stop, restart, or release the ECS instance, or perform these operations by using O&M scripts. Otherwise, the migration fails.

    Step-by-step migration

    Step 1: Import migration source

    A migration source is a physical server, VM, or instance from another cloud platform that you want to migrate.

    Command-line import

    Important
    • The source server must have public network access. If the source server is behind a firewall, see What are the SMC service domains? to obtain the SMC endpoints and ports, and then add them to your firewall allowlist.

    • If your source server cannot access the public network or you want to use a private network for a faster migration, see Private network migration.

    1. Go to the Operating System Migration page in the SMC console.

    2. On the OS Migration page, click Import Source Servers.

    3. Configure the parameters as prompted and copy the activation code command. The following table describes the parameters.

      Parameter

      Description

      Migration Source Type

      Select ECS Instance.

      Import Method

      Select Use CLI to Import Server.

      Migration Source Quota

      The number of migration sources that can be activated by the activation code. Valid values: 1 to 1,000. Default value: 200.

      Validity Period

      The validity period of the activation code, in days. Valid values: 1 to 90. Default value: 90.

      Activation Code

      Generate the activation code and copy the command:

      1. Click Generate.

      2. Click the Linux Shell tab.

      3. Click Copy to copy the activation code command.

    4. Log on to the source server, and then paste and run the copied command with administrator privileges to import the migration source.

      1. Log on to the Linux source server.

      2. Paste and run the copied command with administrator privileges to import the migration source.

        wget https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/China_Mainland/run_smc_client.sh && sudo bash run_smc_client.sh --accesstokenid at-bp1bq****94dnpodl1cm --accesstokencode xxxxxx

        If you receive a message similar to Import Source Server [s-bp18x8751kgz2oyh****] Successfully!, the migration source has been successfully imported.

    5. On the OS Migration page of the SMC console, view the status of the migration source in the Real-time Migration Status column.

      • If the status of the migration source is Online, the import is successful.

      • If the migration source is in another state, the import failed. Troubleshoot the issue and then import the migration source again.

        • Troubleshoot the issue based on the error message in the console or the log file in the SMC client directory. By default, the SMC client is installed in the /smc directory.

        • Common issues and solutions: SMC FAQ and Troubleshoot errors.

    Client import

    Download and configure the client as described in the SMC Client User Guide.

    1. Go to the Operating System Migration page in the SMC console.

    2. On the OS Migration page, click Import Source Servers.

    3. On the Import Migration Source page, configure the parameters as described in the following table.

      Parameter

      Description

      Migration Source Type

      ECS Instance

      Import Method

      Select Use Client to Import Server.

      Description

      In the Description section, download the SMC client for your source server based on its OS and architecture (32-bit or 64-bit).

    4. Import the migration source.

      Important

      Do not close the SMC client during the migration. Otherwise, the migration source loses its connection to the SMC console and the migration fails.

      1. Use a remote connection tool that supports file transfer, such as WinSCP, to upload the SMC client to the Linux source server, or run the command provided in the import instructions to download the SMC client directly on the source server.

      2. Remotely connect to the Linux source server and decompress the SMC client package.

        This example uses the Linux 64-bit General-purpose Edition. If you use a different version of the SMC client, replace the package name in the command with the name of the file you downloaded.

        tar -zxvf go2aliyun_client.tar.gz
        Note

        The Linux 64-bit ARM Edition supports the g6r general-purpose instance family and the c6r compute-optimized instance family. For more information about instance families, see Enterprise-level Arm-based compute instance families.

      3. (Optional) You can filter or exclude files and directories from the migration.

        Important

        If you enable block replication for the migration, you cannot exclude files or directories.

      4. Obtain an activation code or an AccessKey pair.

        • (Recommended) Obtain an activation code: In the Description section of the SMC console, click Generate and copy the activation code.

        • Obtain an AccessKey pair: An AccessKey pair consists of an AccessKey ID and an AccessKey secret. If you have not created one, see Create an AccessKey pair.

      5. In the SMC client directory, run the following commands to start the SMC client.

        The directory go2aliyun_client... is an example. Replace it with the actual directory name created when you decompress the package, as the name varies by client version.
        cd go2aliyun_client2.6.5_linux_x86_64
        sudo chmod +x go2aliyun_client
        sudo ./go2aliyun_client
      6. Enter the activation code or AccessKey pair as prompted. The following example shows how to enter an activation code:

        $ sudo ./go2aliyun_client
        go2aliyun_client China version 2.6.5
        Access Token Id: at-bp1bq****94dnpodl1cm
        Access Token Code: ****

        After entering the activation code or AccessKey pair, the following prompts may appear:

        • If a snapshot driver is not installed on the source system, the SMC client prompts you to install one. Respond to the prompt based on your migration plan.

          • If you plan to enable block replication when you create the migration task, enter yes to automatically install the snapshot driver.

          • If you do not plan to enable block replication, enter no.

          Important

          If the snapshot driver fails to install, do not enable block replication when you create the migration task. Otherwise, the migration will fail.

          Install snapshot dependences(gcc/make/kernel-devel)? (yes/no): yes
        • Most mainstream source systems have rsync installed by default. If rsync is not installed, the SMC client prompts you to install it. Enter yes to automatically install rsync.

          Need to install rsync, run 'apt-get -y install rsync' to continue? (yes/no): yes
        • If SELinux is enabled on the source system, the SMC client prompts you to disable it. Enter yes to automatically disable SELinux.

          Need to disable SELINUX, run 'setenforce 0' to continue? (yes/no): yes

        When you receive a message similar to Import Source Server [s-bp11npxndknsycqj****] Successfully!, the migration source has been successfully imported.

        Note

        If the import fails, troubleshoot the issue based on the returned message. Then, run the following commands to exit the background process and re-import the migration source. For information about common issues and solutions, see SMC FAQ and Troubleshooting.

        sudo ./go2aliyun_client --abort
        sudo ./go2aliyun_client
    5. On the OS Migration page of the SMC console, view the status of the migration source in the Real-time Migration Status column.

      • If the status is Migration SourceOnline, the import was successful.

      • If the status is anything else, the import has failed. See the following solutions to resolve the issue, and then import the data again.

        • Troubleshoot the issue based on the error message in the console or the log file in the SMC client directory. By default, the SMC client is installed in the /smc directory.

        • For information about common issues and solutions, see SMC FAQ and Troubleshooting.

    Step 2: Configure migration

    1. In the Actions column of the migration source that you want to manage, click Start Migration.

    2. In the Migration Settings dialog box, configure the parameters.

      Operating system migration parameters:

      • Current Operating System: The current operating system is displayed by default and cannot be modified. Example: CentOS 7.

      • Destination Operating System: From the drop-down list, select the target operating system. Example: Alibaba Cloud Linux 3.

      • Migration Test (Optional):

        You can enable Migration Test. This feature is enabled by default and supports only Linux migrations. Configure a migration drill.

        Note

        A migration drill simulates the migration to assess feasibility and risks before the actual migration.

        Drills help identify potential problems early and improve migration success rates.

      • Execution Method (Conditional):

        If Migration Test is enabled, you can select an execution mode from the Execution Method drop-down list. The default option is Test and Migrate.

        Differences between the two modes:

        • Test Only: Creates only a migration drill task. After the migration drill is complete, if an operating system migration is required, you must manually start the operating system migration task.

        • Test and Migrate: After the migration drill is complete, if no drill items are in the Critical state, the system automatically starts the operating system migration task.

    3. Click Start Migration. In the Migrate Operating System dialog box, carefully read the notes and then click I Acknowledge.

    4. On the OS Migration page, view the real-time migration status.

      Warning

      During the operating system migration, do not manually stop, restart, or release the ECS instance, or perform these operations by using O&M scripts. Otherwise, the migration fails.

Verify the migration result

  • If the real-time migration status is Completed, the migration was successful.

    Note

    After migration, the ECS instance restarts automatically and performs system initialization (updating packages). Do not operate the instance during this phase, which takes 15 to 30 minutes depending on the number of packages.

    In the Actions column for the migration source, click View Destination Instance. On the instance details page, verify that the instance is now running the target operating system.

    Important

    After migration, the system kernel and packages are replaced while system disk data is retained. Applications may not function correctly due to environmental or dependency changes. Perform thorough testing and validation.

  • If the Real-time Migration Status is InError, the migration failed.

    Troubleshoot the issue and retry the migration:

    1. In the Actions column, click Troubleshoot Errors. Resolve the issue based on the error code and message. For more information, see SMC FAQ and Troubleshooting.

    2. After resolving the issue, click Retry Migration Job in the Actions column. The migration resumes from the point of failure.

      Important

      If the intermediate instance has been released, you must restart the migration. For more information, see What do I do if I accidentally release the intermediate instance?.

    To roll back the source system disk, restore it from the automatically created backup snapshot:

    1. Go to the ECS console - Snapshots.

    2. In the Actions column for the automatic backup snapshot, click Roll Back Disk.

    3. In the Roll Back Disk dialog box, click OK.

Resource cleanup

During migration, Server Migration Center (SMC) creates a pay-as-you-go snapshot named SMC_Backup_Snapshot_XXX to back up the data on the cloud disk of an ECS instance. If you no longer need this snapshot, delete it promptly to avoid unnecessary charges. For more information, see Delete a snapshot.