VMWare partial snapshot recovery HowTo

I recently came across a Vmware server machine that was had a drive that kept expanding until it filled the entire host machine's avaiable space.

The machine in question had a number of drives including a 100GB and a 200GB partition and the host machine had a 600GB partition to hold all this. After digging around a bit I discovered that the drives were performing snapshots. Which means that they main drive was frozen in time and all changes were written to another file.

This should have been an easy fix, tick a box in the admin to remove the snapshot. However, in the admin for the machine there were no snapshots registered and no way to remove them. A bit of hunting found a couple of articles on the subject:

However, I used the following approach to fix the problem which seems to be simpler than the techniques documented above.

Note: make sure you have a backup before proceeding - my 600GB backup took 6 hours but was worth it.

  • Step 1: Make a backup to another drive (internal or USB)
  • Step 2: Check that you can boot your VM from the backup.
  • Step 3: Identify and document all disk names and files
    • Document all drives, paths and scsi/ide nodes
    • Create a text file in the root of each drive - you can then check for this to ensure you have the correct snapshot.
  • Step 4: Use the following command to convert a snapshotting disk to a new clean disk:
vmware-vdiskmanager -r sourceDisk.vmdk -t 3 destinationDisk.vmdk
  • Step 5: In VMWare remove the disk for this machine and then add back your new disk. Make sure you use the same SCSI/IDE node numbers.

Note 1: It is important to select the correct snapshot as the source disk. For example: sourceDisk.vmdk could have a number of snapshots, sourceDisk-000001.vmdk sourceDisk-000002.vmdk. Have a look at the timestamps to determine the active one.

Note 2: If you get the following error:

Failed to open the disk 'sourceDisk-000001.vmdk' : The parent of this virtual disk could not be opened (23).
Don't panic - as long as you have the backups you will be fine. Have a look in the sourceDisk-000001.vmdk and make sure the "parentFileNameHint" path is correct. I.e. if it is an absolute path and you are trying to restore it from a different location (i.e. your backup) you can correct it or simply make it a relative path.

Note 3: It is also very helpful to edit the network settings for the VM to ensure that the network is Not Connected on boot. Particularly if there are mail services or similar running on the machine. This allows you to boot the machine safe in the knowledge that it is completely isolated from outside influence.

Resources

Another useful document which helped out what the file reference on the vmware site - What Files Make Up a Virtual Machine?

Hope it helps. Cheers, Mark

Comments
Sergey's Gravatar VMWare is a very good solution we use to test our data recovery software at MunSoft (http://www.munsoft.com), but sometimes VMWare disks needs to be recovered itself because of software bugs. :-)
# Posted By Sergey | 1/25/08 3:01 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.