Recover a corrupt VM using GParted live CD

This post summaries a procedure I used to recover a corrupt VM.
The VM had 15 snapshots when we looked at the disks, however VMware did not show any.
Disk consolidation did not work, it ended in an error. Using vmkfstools to clone the disk also ended with an error.
Storage VMotion also did not work…

So we tried to come up with an solution to regenerate the VM (which was running fine) but with normal single VMDK disks.
One solution is to start the VM, stop the application services and use the VMware Converter to import this “physical” server.
This solution uses a running machine, this was not my preferred method.
Someone suggested using the GParted Live CD to copy the partition to a new disk and creating a new VM using the vmx file and the new copied VMDK.

We downloaded the GParted Live CD.  We used the amd64 edition.
I always have this ISO with me, but never used it for copy actions.
Download link:

Here is the procedure we used:

  1. Power off the corrupt VM
  2. Attach the ISO to the corrupt VM
  3. We set the Bios splash screen timeout to 10 seconds (
  4. Add a new harddisk to the VM. This wil become your new disk. Make sure it is at least the same size.
  5. Power on the VM and press ESC to access the boot options menu and select CD/DVD drive
  6. GParted is started
    elect the new disk on the top right, it is probably named /dev/sdb or /dev/sdc. It should be empty so easy to recognize.
  7. We create a new partition table on this disk (msdos type)
  8. Select the source disk again (this is the corrupted one).
    Richt click on the 1st partition and select copy.
  9. Select the new empty target disk, right click and select paste.
    Press apply in the toolbar to start the copy process.
    Do this step for each partition, started at the beginning of the disk. With Windows 2008 R2, also copy the small 100 MB partition.
  10. Check if the partition flags are equal, not all flags are copied. I needed to set the ‘boot’ flag on the small 100 MB partition.
  11. After you have copied all partitions, quit from GParted by pressing the red button on the top left and select shutdown.
    During the shutdown process it will ask you to disconnect/eject the CD.
  12. I logged on the the VMware CLI interface and copied the vmx and the newly created disk to a new directory.
    Rename the disk according to the Vmware standards for the first disk.
    Also adjust the vmx file to refelct the disk name changes
  13. Register the VM in VirtualCenter
  14. Check the disk configuration of the VM, when in doubt, remove from config and add the disk again.
  15. Power on your VM

It would have been nice if this was the end, but the VM would not start…
We received a message that windows could not boot.

The solution was quite easy once we found the correct MS KB article:

Start the VM from the Windows DVD and select “repair your computer”. Once started select the command prompt.
Microsoft has created a utility to check the startup configuration and repairs any problems found.
Start this utility from the X-drive: cd \sources\recovery\StartRep.exe

This utility repaired my startup configuration and the VM booted and worked fine!