Manual commit snapshots delta file to vmdk flat file
Posted by craig
- on March 4th, 2009 in Tips, Virtualization | 6 Comments »

I had a tough time this week to deal with the snapshot issue with one of the VM. The VM is containing an important snapshot that previously taken for system restoration. When I browsed through the snapshot manager from vCenter, the system show my VM was running without any snapshots. Here was the kicked start of my problem and excited journey until I managed to recover it this morning.
I tried to SSH to the ESX host and browse to the specified datastore, and I found the snapshot file which end with file extension .vmsn were available in the correct location. No matter how many times I tried and rebooted my Virtual center, the snapshot were not visible to the snapshot manager still.
I read through some articles and forums which suggested to clone the snapshot by using vmkfstools -i option, but it didn’t success in my case here, and I continue my research and here I found a useful blog post from 1 of the blogger Oliver O’Boyle who experienced similar issue previously.
After I read through his article, which explained the chain within the CID and parent CID, it does help me to resolve my issues. I found that the root cause of my VM was due to the snapshot problem & vmdk config file corruption. For snapshot issues, we can recreate a new snapshots and we select to delete all snapshot afterward, it should force the vmdk flat files and delta files to be committed. In 1 of the virtual hard disk, we experience difficulty as the ESX servers will force the virtual HDD to be detached from the VM. The root cause of that was caused by the file missing on the parent file which should be VMxxxx.vmdk.
During this troubleshooting, you should ensure that the delta files and flat files are always retained and not overwritten. There are 2 delta files which end with VMxxxxx-000001.vmdk and VMxxxxx-000001-delta.vmdk. Your flat file should end with VMxxxxx-flat.vmdk. The 1st thing I did, was to ensure the virtual disk was able to re-attached the vm. I had manually created a new vmdk config file follow the guide from the Oliver O’Boyle, and I copy the parent CID and virtual disk value number require. I had manually configured the link within .vmdk and the flat file. After that, I was able to attach the virtual disk back to the VM from virtual center. Please take note that the virtual center will not see the flat files as the attachable virtual disk, as vCenter recognize the virtual disk base on the location of .vmdk. Recommended to keep the .vmdk and flat file within same datastore. You can also relocate the vmdk files to different datastore if you wish to do so.
Once the virtual disk had been attached to the VM, boot up the VM immediately. Please log in to the system and ensure everything is in normal and functioning correctly. The data I contained now, wasn’t the latest data I needed as the result of the missing snapshot which was not committed by the system. Now, I take a new snapshot for my entire VM. Once I had done that, datastore in SSH showed up with plenty of delta files and newly created VMDK files which end with VMxxxxxxx-000003.vmdk and so on.
Here are the steps been taken to commit the snapshots manually
- Power off the VM
- Right click the VM and select edit settings from vCenter and select the virtual disk that you are trying to recover. The system will show which vmdk files this virtual disk is pointing to
- Copy down the file names and go back to your SSH screen
- Replace the VMDK and delta files that you previous retain from your original snapshots which you are recovering with the FILE NAMES that you copy on step 2
- Open up the snapshot manager for the VM, and select delete all snapshots option. This process will take time as it depend the size of your delta files require to be committed.
- It should stuck at 95 % or time out, but the system will still continue to commit the delta files back to the flat files. In my case, it took more than 2 hours to delete the snapshot
- I noticed the ESX server load and disks activity increased from the performance chart
- Once it completed, all the delta files will be deleted and everything should be back to normal
- Power on the VM and double check all the data and mount point and I found the system was back to normal

6 Responses
I’ve got absolutely no idea what you just said, but thanks anyway.
Hi VMguy, this post is explaining the manual way you can recover a snapshot delta file and force it to be committed to the flat file. In normal case, when you remove the snapshot from snapshot manager, the system will commit the delta and emerge back with the flat file. Delta file is appear after the snapshot happen, as it contains the changes of the virtual disk after the snapshot.
In my case, my snapshots disappear from the snapshot manager, and 1 of my virtual disk had been forced to detach from the VM. To reattach the virtual disk with the latest data in there, I was required to merge the delta file with the flat file, and a rebuilt on the .vmdk file was required.
[...] process. So you might just need this link to recreate the vmdk. You may find yourself in need of this process to commit the snapshot as well. Or, if you’re really lucky, you’ll find yourself with a [...]
What command did you use to merge delta disks to base disk ? What order do we to follow ? (Tail to Head or Head to Tail)
The method I used is to delete all the snapshot after I rebuilt the chain, therefore, I do not have any command to do so. The method you need to rebuild should be tail to head. Once the chain rebuilt and you select to delete all snapshots, it will force to commit all the delta file back to single -flat.vmdk
Check out this KB @ http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003743