How to Safely Recover Deleted Snapshot on VMware
If you mistakenly deleted VMware snapshots from datastore, and now you find yourself cannot power on the VM, is there any way to recover them and fix the VM? In this article, I will introduce how to solve this.
VMware error caused by wrongly deleting snapshot files
About a week back, I needed to restore VM. I did so, but I did it improperly. I deleted 2 files while the VM was still on and before I cloned it, but after that the VM wouldn't boot. I've been trying to restore to the most recent snapshot since, but I haven't succeeded. Please let me know if you have any ideas
- Question from communities.vmware.com
If you failed to power on the VMware VM and received the error notification of "The system cannot find the file specified. Cannot open the disk or one of the snapshot disks it depends on", this may be caused by missing of VM disk .vmdk descriptor or data files, or the VMware snapshot chain becomes inconsistent.
You may have wrongly deleted snapshot files, or the snapshot files may be corrupted. To avoid serious data loss, is there any way to recover a deleted snapshot on VMware?
Can you recover deleted snapshot on VMware
The answer is YES depending on different situations.
✦ If you only deleted the snapshot descriptor files (file name: VMname-00000#.vmdk), you can recover the deleted snapshot by recreating the descriptor files.
✦ If you deleted the snapshot data files, there’s no built-in way to recover them. You may need to seek help from third-party tools, or just recover the parent VM disk to restore the VM to the state it was in before the snapshot was taken, and losing later data.
✦ If you keep taking regular backups of your VM, you can restore it safely whenever you want.
What happens when you taking and deleting a VMware snapshot
Taking a VMware snapshot will create the following files:
- VMname.vmsd: a snapshot list file that stores the names, descriptions, and relationships of all snapshots. It is created with the VM, and appears in the VM directory whether or not a snapshot exists.
- VMname-00000#-delta.vmdk: a differencing disk file created when the snapshot is taken. Taking a snapshot will preserve the state of the VM and stop writing to the VMname-flat.vmdk file, all later writes will be redirected to VMname-00000#-delta.vmdk.
- VMname-00000#.vmdk: a disk descriptor file that contains information about the snapshot and its disk. It is created for each snapshot when they are taken, and updates the parent disk information. For the first snapshot, the parent is the base disk, for subsequent snapshots, the parent is the previous snapshot disk.
- VMname-snasphot#.vmsn: a snapshot state file that stores the state of the VM when the snapshot was taken. It is created with snapshot and deleted when the snapshot is properly deleted. The size will increase if you selected the Memory option.
- VMname-snapshot#.vmem: contains all the contents of the VM's memory when the snapshot was taken, created only if you select the Memory option.
Deleting VMware snapshots from snapshots manager is completely different from deleting them from datastore.
Deleting VMware snapshots from snapshots manager is the proper use of snapshots. It will consolidate the data in VMname-00000#-delta.vmdk to the parent disk, and later changes will be redirected back to the parent disk.
Deleting VMware snapshots from datastore is just deleting the files. If you delete the VMname-00000#-delta.vmdk files, you will lose the data stored after the snapshot was taken. You can only recover deleted vmdk files from VM backups, or using third-party tools.
If you deleted VMname-00000#.vmdk files from datastore, you won’t lose the data, but still not be able to open the VM, you can recover them by recreating them.
In this article I will introduce the specific steps to do this.
How to recover deleted snapshot on VMware
1. Access to vSphere Web Client. Navigate to Storage in the left inventory, and click Datastore browser.
2. Open the target VM folder, and Download all the files in it to local.
3. Open the vmdk files with Notepad, to find the parent disk and file name of the deleted snapshot.
4. Copy one of the snapshot descriptor files and rename it with the name of the deleted snapshot.
Here I copied snapshot1 for recovering deleted snapshot2 as a demonstration.
5. Open the copied file with Notepad, and change the values of parentFileNameHint=" VMname.vmdk" with the parent disk name of the deleted snapshot, and values of RW 12582912 VMFSSPARSE "Windows Demo-00000#-delta.vmdk" with the file name of the deleted snapshot delta disk name.
For example, my snapshot2’s parent is snapshot1, so I change parentFileNameHint=" Windows Demo.vmdk" into parentFileNameHint=" Windows Demo-000001.vmdk"
And change RW 12582912 VMFSSPARSE "Windows Demo-000001-delta.vmdk" into RW 12582912 VMFSSPARSE "Windows Demo-000002-delta.vmdk"
6. Upload the deleted snapshot descriptor file to the target VM folder in Datastore. Now you can see that you’ve recovered the deleted .vmdk file and the VM can be powered on.
Security tips: Backup VMs regularly in case of the recovery needs
Sometimes tiny mis-operations can lead to serious data loss. Just like I mentioned before, if you wrongly deleted the delta disks of VMware snapshots, you can only get them back from backups, or you may loss the later data forever. That’s why backups are so important.
Backup files can be stored independently in a local, network or cloud location, so they are not easily deleted by mistake and you don't have to worry about running out of disk space. Therefore, in order to ensure data security and efficient backup, you can use backup software.
In this part, I use a professional and free VMware backup software called AOMEI Cyber Backup to perform secure backup and restoration. It is a professional software and allows you to select backup types such as incremental backup, schedule regular VM backup and achieve fast recovery.
Simple steps to schedule VM backup:
1. You can click the button below to download the perpetual free edition, and access the main interface to add Hyper-V, vCenter or Standalone ESXi host as the source device.
It supports both paid and free versions of VMware ESXi 6.0-7.0 and Hyper-V 2012 R2-2022.
*You can choose to install this VM backup software on either Windows or Linux system.
2. Click Backup Task >> Create New Task to start configuration.
✜ Enter task name, select device such as VMware ESXi and the virtual machines. Then select Backup Target. It is flexible for you to select local path or network path to store VM backups.
✜ Schedule backup task: select backup way such as full/incremental/differential backup and when to perform the backup task.
You are able to combine the backup ways such as full backup + incremental backup. It saves storage and performs the backup task automatically so as to offer you the regular backups for convenient restoration.
3. Click Start Backup to execute the operation.
After creating backup task, it will back up virtual machines as you scheduled. Then you can simply click Restore the entire virtual machine from any history backup version.
This page introduces in VMware, how to recover deleted snapshot in order to boot VMs properly. In addition to this, you should also note that VM snapshot and backup cannot replace each other. In practical use, you should only take VM snapshots before important changings and remember to properly delete them from snapshot manager afterwards. For enterprise backup, please use backup for data protection.