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
VMware error caused by wrongly deleting snapshot files
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 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 you are 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 it 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.
Using regular backups to protect VM securiry
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 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.
Efficient ways to schedule VM backup
1. Access to AOMEI Cyber Backup and bind the devices to it.
2. Click Backup Task >> Create New Task to start configuration.
3. 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.
4. 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.
5. Select retention policy for each backup.
6. Click Start Backup.
After creating backup task, it will back up virtual machines as you scheduled. Then you can simply click Restore to original/new location to achieves fast recovery to original/new location.
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.