All Products
Search
Document Center

Elastic Compute Service:Restore data from an original system disk snapshot after replacing the system disk

Last Updated:Mar 20, 2026

When you replace the operating system of an Elastic Compute Service (ECS) instance, its system disk and image are also replaced. The original system disk is released and all its data is deleted. Therefore, you cannot use a snapshot of the original disk to roll back the new system disk. This guide explains how to restore data from the original snapshot after the replacement.

Prerequisites

Procedure

Step 1: Create a disk from a snapshot

  1. Go to ECS console - Snapshots.

  2. In the top navigation bar, select the region and resource group of the resource that you want to manage. Region

  3. On the Disk Snapshots tab, find the snapshot that you want to use. In the Actions column, click 更多 > Create Disk.

  4. Select Attach to ECS Instance and enter the ECS instance ID. For more information about other parameters, see Parameter details.

  5. Confirm the configuration and fees, and then complete the purchase as prompted.

Step 2: Log on to the ECS instance and restore data

This example uses an instance whose original operating system was Alibaba Cloud Linux 3.2104. Partitions may differ on other operating systems. Adjust the steps accordingly.

  1. Connect to the ECS instance.

  2. Run the following command to list the partitions on the attached disk.

    sudo fdisk -lu

    截屏2025-01-17 10

    In this example of an Alibaba Cloud Linux 3.2104 system, the disk has three partitions:

    The first partition, /dev/vdb1, stores the bootloader, which enables the system to boot from the Cloud Disk. No action is needed on this partition.

    The second partition, /dev/vdb2, stores the EFI boot program, which enables the system to boot by using EFI firmware. No action is needed on this partition.

    The third partition, /dev/vdb3, stores the operating system files and data. This partition contains the data you need to restore.

    Partitions vary by operating system. The partitions on your disk may be different.

  3. Run the following command to create a new mount directory. This example uses /temporary. Replace it with your actual directory name.

    sudo mkdir -p /temporary
  4. Run the following command to mount the file system. Replace /dev/vdb3 with your data partition and /temporary with your mount directory.

    sudo mount /dev/vdb3 /temporary
  5. Run the following command to copy files. This example copies data from the /mnt directory on the old system disk to the /mnt directory on the new system disk.

    sudo cp -v /temporary/mnt/* /mnt

    Alternatively, you can install the rsync tool to copy files and view the progress.

    sudo yum install -y rsync
    rsync --progress /temporary/mnt/* /mnt

Step 3: Verify that services are running properly

  1. After the data is copied, restart the relevant services and check that they are running correctly.

  2. After confirming your services are running correctly, detach and release the data disk created from the snapshot. For more information, see Detach data disk and Release a disk.