When you use a Windows Elastic Compute Service (ECS) instance, a common O&M operation is to delete the files that you no longer require. This helps reduce disk usage. If files are deleted due to accidental operations, program anomalies, or viruses, you must restore the files. This topic describes how to restore data after files are accidentally deleted from a Windows instance.
Background information
The workflow and tools described in this topic provide a comprehensive solution to restore files that are accidentally deleted. The extent to which files can be restored may vary based on your business scenario and operation method. We recommend that you take reasonable data restoration measures based on your actual business scenario.
Preparations
Before you restore data, you read the Workflow section of this topic.
You have the required knowledge and skills on how to restore data to prevent data corruption.
Before you restore data, you create snapshots for the disks whose data you want to restore. This prevents data from being corrupted due to incorrect operations.
Third-party software is used as a data restoration tool in this topic. Alibaba Cloud cannot guarantee to the extent to which files are restored by using third-party software.
DiskGeniusis third-party software. Fees are charged for specific DiskGenius features. For more information about software fees, go to the DiskGenius website.If the data that you want to restore is critical, and you do not have the relevant expertise in data restoration, we recommend that you contact a professional data restoration agency, instead of manually restoring data.
Workflow
Operation guide
The preceding flowchart describes common data restoration methods after data is accidentally deleted from Windows instances. The following section describes how to restore data in the following scenario.
Scenarios
You accidentally deleted specific files from an ECS instance. As a result, the instance failed to start.
You did not create snapshots before the delete operation or do not want to use snapshots to restore data.
You want to restore data by using another
Windowsinstance.
Operation flowchart
The following flowchart shows the procedure of data restoration for the preceding scenario.
Procedure
Create snapshots for the current instance.
Before you restore data, we recommend that you create a snapshot for the system disk or data disk whose data you want to restore. This way, you can use the snapshot to back up existing data and prevent file corruption during subsequent restoration operations. For information about how to create a snapshot, see Create a snapshot.
Detach the system disk or data disk whose data you want to restore from the instance and attach the disk to another instance.
WarningBefore you detach the system disk, you must stop the associated instance. If you perform the stop operation in the ECS console, select Force Stop. Otherwise, the instance fails to be stopped.

You can detach the system disk or data disk from the source instance and attach the disk to another normal
Windowsinstance to restore data. For information about how to detach and attach a data disk, see Detach or attach a system disk.WarningWhen you attach the original system disk to another instance as a data disk in the ECS console, the system disk file system may be corrupted. As a result, the ECS console prompts you to initialize the disk. To prevent data corruption, we recommend that you do not click Initialize Now in the ECS console to re-initialize the disk. Close the dialog box and proceed to the next step.

Restore the accidentally deleted data.
Connect to the Windows instance to which you attach the disk whose data you want to restore. For more information, see Connect to a Windows instance by using a username and password.
Download
DiskGenius.Download the
DiskGeniuspackage from the DiskGenius website.Decompress the
DiskGeniuspackage and double-click theDiskGenius.exefile to runDiskGenius.Right-click the partition for which you want to restore files and select Recover Lost Files from the short-cut menu.
In the dialog box that appears, retain the default settings and click Start to scan files. 
In the message that appears, click OK.

On the Files tab, select the file that you want to restore, right-click the file, and then select an appropriate operation from the short-cut menu to restore the file to a specific path.
ImportantDiskGeniusis third-party software for disk management.DiskGenius, but not Alibaba Cloud, may charge fees for file restoration. For information about fees for DiskGenius usage, go to the DiskGenius website.
The preceding procedure describes the required steps for restoring files by using DiskGenius. For more information about file restoration by using DiskGenius, go to the DiskGenius website.
Common misunderstandings and best practices
Data is the core asset of users. A large number of users build websites and create self-managed MySQL, MongoDB, or Redis databases on ECS instances. Data loss may cause huge risks to business. The following section describes the common misunderstandings and best practices in data security:
Common misunderstandings
The underlying storage of Alibaba Cloud is based on the triplicate storage technology. As such, specific users consider that no risk of data loss exists in the operating system. This is a misunderstanding. The triplicate storage technology protects data on data disks at the physical layer. However, logical issues, such as viruses, accidental deletions, or file system corruption, can cause data loss. To mitigate the risks, you must use related technologies, such as snapshots and geo-redundancy, to improve data security. For more information, see Triplicate storage.
Best practices
Data disk partition restoration and data restoration can be used to address data loss. However, the solutions may be unable to restore data as expected. We recommend that you follow the best practices to create automatic or manual snapshots for data and use different backup methods to maximize your data security.
Apply automatic snapshot policies
You can apply automatic snapshot policies to system disks or data disks to create automatic snapshots for the disks.
ImportantWhen a system disk is replaced, an instance expires, or a disk is manually released, the associated automatic snapshots may be released. If you want automatic snapshots of a disk to be released along with the disk, you can select Delete Automatic Snapshots While Releasing Disk in the Modify Attributes dialog box in the ECS console. If you want to retain the automatic snapshots when the disk is released, clear this option. For more information, see Snapshot FAQ and Create an automatic snapshot policy.
Create manual snapshots
Before you perform the following important or high-risk operations, you must manually create snapshots for disks:
Update the kernel.
Upgrade or change applications.
Restore data on disks.
Before you restore a disk, you must create a snapshot for the disk. Then, perform the corresponding operations after the snapshot is complete.
Object Storage Service (OSS) backup, offline backup, and geo-redundancy
You can back up important data by using OSS backup, offline backup, or geo-redundancy based on your business requirements.
References
For information about how to restore data on Linux instances, see Best practices for restoring data on Linux instances.