All Products
Search
Document Center

Elastic Compute Service:How to restore data from a system disk snapshot after replacing the system disk

Last Updated:Jun 20, 2026

Replacing the operating system by replacing the system disk also replaces the system disk and its image. The original system disk is released, and all its data is deleted. Therefore, you cannot directly roll back using a snapshot created from the old system disk. This topic explains how to restore data from a snapshot of the original system disk after replacing the system disk.

Prerequisites

Procedure

Step 1: Create a disk from the snapshot

  1. Go to ECS console - Snapshots.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. On the Disk Snapshot tab, find the snapshot you want to use. In the Actions column, click More > Create {category}.

  4. Select Attach to ECS Instance, and enter the ECS instance ID. For more information about other parameters, see Detailed explanation of configuration parameters.

  5. Review the configuration and cost, then complete the purchase as prompted.

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

This example uses Alibaba Cloud Linux 3.2104 as the original operating system. Partition layouts may differ across operating systems. Adjust accordingly based on your actual setup.

  1. Connect to the ECS instance remotely.

    For more information, see Log on to a Linux instance using Workbench.

  2. Run the following command to get the device name of the data disk.

    sudo fdisk -lu
    [ecs-xxx                              ~]$ sudo fdisk -lu
    Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
    Units = sectors of 1 × 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x000edc45
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    83886046    41941999+  83  Linux
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
    Disk /dev/vdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
    Units = sectors of 1 × 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: gpt
    Disk identifier: 6CA42D45-D495-417A-99B7-DFFEF4B29C93
    #         Start          End    Size  Type            Name
     1         2048         6143      2M  BIOS boot
     2         6144       415743    200M  EFI System
     3       415744     83886046   39.8G  Linux filesyste

    This example uses Alibaba Cloud Linux 3.2104, which has three partitions:

    The first partition, /dev/vdb1, stores the boot loader and ensures the system can start normally from the disk. You do not need to focus on it.

    The second partition, /dev/vdb2, stores the EFI boot program and ensures the system can start using EFI firmware. You do not need to focus on it.

    The third partition, /dev/vdb3, stores operating system files and data—the data you need to restore from the system disk.

    Partition layouts vary by operating system. Adjust based on your actual setup.

  3. Run the following command to create a mount directory. This example uses /temporary. Modify it as needed.

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

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

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

    Alternatively, install the rsync tool for file copying with progress tracking.

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

Step 3: Verify that your services run normally

  1. Verify that your services are restored. After completing the operation, restart related services and check whether they run normally.

  2. After you confirm that your business runs as expected, detach the data disk created from the snapshot of the original system disk and release the data disk. For more information, see Detach Data Disk and Release Disk.