This topic describes how to roll back a disk by using a snapshot. When the system does not respond or an incorrect operation is 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 one snapshot for the disk. You can roll back both system disks and data disks. When you roll back a system disk, the instance is automatically bound with the current SSH key pair or the username and password combination.
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. For more information, see Create a snapshot of a disk. Warning The rollback operation is irreversible. After a disk is rolled back, the data that you added, removed, or changed from the time when the snapshot is created to the time when the disk is rolled back is lost. To avoid data loss caused by accidental changes, we recommend that you create a snapshot for the disk to back up data before you roll back the disk.
- The disk is not released.
- After the operating system is replaced, snapshots of the previous system disk cannot be used to roll back the new system disk. Note You can use the snapshots to create pay-as-you-go disks and then attach the disks to ECS instances for data restoration. After data is restored, we recommend that you release the disks in a timely manner. For more information, see Create a disk from a snapshot, Attach a data disk, and Release a 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. Important If the billing method of an instance is pay-as-you-go and the network type of the instance is VPC, you must enable the standard mode for the instance when you stop the instance. If you enable the economical mode for the instance, you may not be able to start the instance after its disk is rolled back.
Roll back a disk by using a snapshot
You can roll back a disk on the Snapshots or Instances page. This section descirbes how to roll back a disk on the Instances page.
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- Find the instance whose disk you want to roll back and click the instance ID.
- The Instance Details tab appears. Click the Snapshot tab.
- Find the snapshot that you want to use to roll back the disk and click Roll Back Disk in the Actions column. Note You can roll back only one disk on an instance at a time. Other disks that are attached to the instance are not affected. After the rollback operation is complete, the entire disk (not a partition or a directory) is restored to the state that the disk was in when the snapshot was created.
- In the Roll Back Disk dialog box, click OK. Note
- Before you click OK, we recommend that you click Create Snapshot to back up the latest data.
- If you select Start Instance After Disk 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 want to synchronize the data that you added, removed, and changed after T1, you can perform the following operations:
- Create Snapshot B for the original disk at the point in time T2.
- Roll back the original disk by using Snapshot A.
- Create a disk by using Snapshot B. For more information, see Create a disk from a snapshot.
- Attach the new disk to the same ECS instance. For more information, see Attach a data disk.
- Connect to an ECS instance. For more information about connection methods, see Connection methods .
- View the new disk.
- Windows instance: The new disk is displayed in the system.
- Linux instance: Run the mount command to mount the partitions of the new disk.
- Copy useful data from the new disk to the original disk.
- Optional: Release the new disk.