VMWARE (ESXi 5.1): Rebuilding a corrupted vmx file.

Leave a comment

July 26, 2013 by aubreykloppers

Last night I lost 2 of my VM’s due to corrupted vmx files.  The fix was quite easy:

* You can create a copy of the directory and remove the vmx file from the new directory, else just remane the vmx…

cd to the VM’s direcotry:

cd /vmfs/volumes/<drive>/<vmdir>

create a new file:

vi fix-vmx.sh

add the following content:

VMXFILENAME=$(sed -n ‘s/^.*Config file: .*\/\(.\+\)$/\1/p’ vmware.log)
echo -e “#41/usr/bin/vmware” > ${VMXFILENAME}
echo ‘.encoding = “UTF-8″‘ >> ${VMXFILENAME}
sed -n ‘/DICT — CONFIGURATION/,/DICT —/ s/^.*DICT \+\(.\+\) = \(.\+\)$/\1 = “\2″/p’ vmware.log >> ${VMXFILENAME}

Save the file and change permissions:

chmod 777 fix-vmx.sh

run the script:


found at: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1023880

A nice read : VMware: Ultimate guide powering on a virtual machine unable to access a file since it is locked with raw device mappings

And: Investigating virtual machine file locks on ESXi/ESX (10051) – Look for the “ESXi troubleshooting steps” section

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

counter for wordpress
%d bloggers like this: