All Products
Search
Document Center

Elastic Compute Service:Use a snapshot of the original system disk to restore data after the system disk is replaced

Last Updated:Jan 15, 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 topic describes how to restore data from a snapshot of the original system disk after it is replaced.

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. 地域

  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 obtain the device name of the data disk.

    sudo fdisk -lu

    截屏2025-01-17 10

    In this example, which uses Alibaba Cloud Linux 3.2104, the disk has three partitions:

    The first partition, /dev/vdb1, stores the boot loader. This ensures the system can boot from the disk. You can ignore this partition.

    The second partition, /dev/vdb2, stores the EFI boot program. This ensures the system can boot using EFI firmware. You can ignore this partition.

    The third partition, /dev/vdb3, stores the operating system files and data. This is the data that 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 correctly

  1. Verify that the service has recovered. After the operation completes, restart the related services and verify that they are running normally.

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