Recreate/Repair .vmdk files in VMWare

I recently had to move a VMWare virtual machine from one physical host to another. I removed the VM from the inventory of the initial host and added the VM to the inventory of the second. When I tried to power on the VM I got a “File not found” error in addition to a “Failed to open disk 0 … After doing some google searching I realized that I was missing my .vmdk files for the disks, not the -flat.vmdk files with the actual data but the descriptor .vmdk files.

I found this very useful post here that saved me:

Instructions from the post are below:

The following steps will guide you to recreate your vmdk files (.vmdk):

  1. Determine the hard disk sizes of your original VM (I call this VM from now on: VM A)
  2. Create a new VM (I call this VM from now on: VM B) with VirtualCenter with the same number of hard disks as your old VM, and the exact same sizes. So: if your original VM contained 2 harddisks from 8,00GB and 12,00GB, recreate these harddisks exactly the same in your new VM. In addition, if you have more than one iSCSI target, make sure you create the new VM on the same iSCSI target as the original. Then you only have to change the flat.vmdk file name.
  3. After your VM B has been created, use Putty (or a similar tool) to navigate to your ESX server. Then navigate to the location / directory where your VM B is stored.
  4. Copy all VMDK’s (not the flat ones, but only the metadata files) to your VM A directory. The filesize of your META-data files should be a few KB.
  5. Navigate to your VM A directory. You just copied the *.VMDK files to this directory. Edit the VMDK’s with a text editor: You should replace the old filenames with the correct file names -> They refer to the new VM B, but they should refer to your old (original) VM A
  6. Save the files.
  7. Load the VM in your VirtualCenter. You should now be able to add th flat.vmdk to your VM.