Recreating a missing virtual disk (VMDK) header / descriptor file for VMware ESX

Uploaded by VMwareKB on 06.11.2009

This video will discuss recreating a missing .vmdk descriptor file on an ESX host.
To resolve this issue, we need to log onto your ESX host's command line.
Here I am using a PuTTY SSH session.
When we list out the files in the virtual machine's home directory
we can see that there is a descriptor file missing for the associated flat file.
So we are going to continue and recreate the missing descriptor file.
The first piece of information that we need to know is the SCSI controller type
and we can get this from the virtual machine's configuration file as follows.
Here we can see that this virtual machine is using "lsilogic".
The next piece of information that we need to know is the exact size of the flat file for the virtual machine.
We can find this out as follows.
We will now make use of the two bits of information that we have already gathered
and use this with the vmkfstools command to create a temporary .vmdk flat file and associated descriptor file.
Here I enter the size of the original flat file.
Followed by the SCSI logic controller
I've got to use the -d option
to thin provision the disk so that it saves space on the datastore.
And finally give the new flat file a name.
Just to check that the vmdk's were created
Here we see the new flat file that was created (the temporary flat file)
and its associated descriptor file.
Now we're going to modify this temporary descriptor file to resolve the issue.
We will now rename the temporary descriptor file to match the original virtual machine's flat file.
We now need to edit the descriptor file and
change a line so that it points from the temporary flat file to the original virtual machine's flat file.
We can use vi to do this.
I just replace "temp" with the original virtual machine's name.
If the original virtual machine's disk was not thin provisioned
then we need to remove the following line from the newly created descriptor file.
We can verify if this was the case using the "du" command.
Here we see that the original virtual machine's flat file was not thin provisioned.
Whereas the temporary flat file that we created, which was also 5 GB in size
only takes up 1 MB because it was thin provisioned.
In this example, once we have removed the following line from the descriptor file
the virtual machine is now ready to power on.
For further information, please consult VMware Knowledge Base article 1002511.