This topic describes how to roll back a disk by using a snapshot. When the system is unresponsive or an incorrect operation was performed, you can roll back a disk to a previous version by using its snapshots. Before you roll back a disk, you must have created at least a snapshot of the disk. If you roll back system disks, the current SSH key pairs or usernames and passwords of the instances remain bound to the disks after the disks are rolled back.

Prerequisites

Before you roll back a disk by using a snapshot, take note of the following items:
  • A snapshot of the disk to be rolled back is created, and no new snapshot is being created for the disk.
    Warning The rollback operation is irreversible. After a disk is rolled back, the data from the creation of the snapshot to when the disk is rolled back is lost. To avoid data losses caused by incorrect operations, we recommend that you create a snapshot for the current disk before you roll back the disk.
  • The disk has not been released.
  • After you replace the system disk, snapshots of the previous system disk cannot be used to roll back the new system disk.
  • If you use a disk to create a dynamic extended volume or redundant array of independent disks (RAID), you must stop all I/O operations on the disk before you roll back the disk.
  • The disk is attached to an ECS instance and the instance is in the Stopped state. For more information, see Attach a data disk and Stop an instance.
    Note A pay-as-you-go instance in a VPC may not be restarted after its disk is rolled back if the No Fees for Stopped Instances (VPC-Connected) feature is enabled. We recommend that you disable the No Fees for Stopped Instances (VPC-Connected) feature before you stop the instance. For more information, see No Fees for Stopped Instances (VPC-Connected).

Roll back a disk by using a snapshot

You can roll back a disk from the Snapshots or Instances page. The following example shows how to roll back a disk from the Instances 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 a region.
  4. Find the instance whose disk you want to roll back the disk and click Manage in the Actions column.
  5. In the left-side navigation pane, click Snapshots.
  6. Find the target snapshot and click Rollback Disk in the Actions column.
    Note You can roll back only one disk at a time. Other disks that are attached to the instance are not affected. After the disk is rolled back, the disk is restored to the status of the entire disk at a certain point in time, instead of the status of a partition or a directory.
  7. In the dialog box that appears, click OK.
    Note If you select Start Instance Immediately after Rollback, the instance automatically starts after the disk is rolled back.

(Optional) Synchronize data after a disk is rolled back

If you roll back a disk by using Snapshot A that was created at the point in time T1 and you need to synchronize the data after T1, you can perform the following operations:Synchronize data
  1. Create Snapshot B for the original disk at the point in time T2.
  2. Roll back the original disk by using Snapshot A.
  3. Create a new disk by using Snapshot B.
    For more information, see Create a disk from a snapshot.
  4. Attach the new disk to the same ECS instance.
    For more information, see Attach a data disk.
  5. Remotely connect to an ECS instance. For more information, see Overview.
  6. View the new disk.
    • Windows instances: The new disk is displayed in the system.
    • Linux instances: Run the mount command to mount the new disk.
  7. Copy useful data from the new disk to the original disk.
  8. Optional:Release the new disk as needed.

What to do next

If you resize a disk after you create a snapshot for the disk, the size of the disk is also rolled back after you roll back the disk. To make the disk revert to the size before the rollback, you must log on to the instance to resize the file system again.