VMware ESX – How to easily recreate a missing or corrupt VMX file.

Do you have a VM that is missing its VMX file or maybe the VM’s VMX file has corrupted?

Now you could manually recreate a missing or corrupt VMX file (restoring one from a backup would be the best solution) but a quick and easy way for recreating it is to create a new VM within the VMware Infrastructure Client (VIC) or via CLI/RCLI.  During the creation process point the new VM’s drives to the existing disk (VMDK) files of the server with the corrupt/missing VMX file.

Below are the basic steps for doing this via the VMware Infrastructure Client interface.

Before beginning to start the process to recreate the VMX file, if it exists, remove the VM from the VMware Infrastructure Clients inventory list (right click on the VM and select ‘Remove from Inventory’). Also if you are trying to replace a corrupted VMX file then rename (preferable option) or delete the offending VMX file.

First start the ‘New Virtual Machine Wizard’ and select a ‘Virtual Machine Configuration’ type of ‘Custom’. 


The next page of the wizard will ask for a ‘Name’ for the new VM.  Make sure the name you type in here matches the name of the directory on your VMFS partition that hosts the VM with the missing/corrupt VMX file. 

If you enter in a different name here the New Virtual Machine Wizard will create a directory of that name that will contain the VMX file (along with a couple of other files important to the running of the VM) whilst your disk (VMDK) file(s) could be located in another directory.  Although there are potentially situations where you may want to keep your disk and configuration files separate I would personally recommend keeping them all together to reduce the risk of any future confusion and accidental moves or deletions of these VM related files.


The next screen of the Wizard asks for you to select the location of the datastore.  As mentioned above, in most situations it is best to select the same LUN/Disk on which the VMDK (disk) files are located.


Now proceed through the next few steps of the Wizard selecting and adjusting (if required) any of the VM configuration parameters (eg: Guest OS, number of virtual processors, memory, etc).

When you get to the ‘Select a Disk’ screen then select ‘Use an existing virtual virtual disk’ and select the primary VMDK boot disk file for the VM with the missing/corrupt VMX file. 


Proceed through the rest of the Wizard until you get to the ‘Ready to ‘Complete New Virtual Machine’ screen. At this point if you wish to add any additional secondary (eg: data) disks then check the ‘Edit the virtual machine settings before submitting’ box and add in any additional disks, NICs, etc.


Once complete then press the ‘Finish’ button.  Within the VMware Infrastructure Client interface you will now see the newly recreated VM back in the inventory list.

Using the ‘Datastore Browser’ navigate to the folder of VM and you should now see a freshly created VMX file.


You are now ready to start the VM with its new VMX file.  Good Luck!


  • Marino Duregon

    Your method helped to prove that I could recover from a corrupted template file (.vmtx).

    However this other KB article (KB Article: 1003597 ‘http://knova-prod-kss-vip.vmware.com:8080/selfservice/dynamickc.do?cmd=show&forward=nonthreadedKC&docType=kc&externalId=1003597′ ) which suggest you to look at your vmware.log file and isolate the “— CONFIGURATION” section shows you exactly what is being parsed and recognized and, conversely, what is not being parsed correctly by ESX upon the startup of the VM.


    • Chris

      Great tip! I will have to add this to my notes. Noone, good info to know about the MAC. I have a script I found and modified to to now do regular .vmx backups. http://www.chrisleblanc.org/poor-mans-virtual-machine-backup-powercli-updated/

      • http://techhead.co/ Simon Seagrave (TechHead)

        Hi Chris,

        Thanks for sharing your link. This will definitely come in handy for myself and others.



  • Kunal

    Thanks..you saved my life :)

    • Kunal

      Just be careful to choose the right OS otherwise you will get an ERROR while starting the VM :- handshake failed for mks of /vmfs/volumes/…

      The Guest OS can be changed later under Editsettings/options/..if you get the error.

      Thanks again KIWI!!

  • Larow

    Thanks a lot Kiwi! Really helpful post ! You saved my life !

    • http://techhead.co Kiwi Si

      Hi Larow,

      Glad it helped :)

      All the best,


  • Ed

    Great Instructions…..

    However my foo-flat.vmdk does not show up while creating a new VM.

    I can see the file while browing through the host so I know its there.

    Any thoughts?


  • Tom Berchenbriter

    I too have the same issue, vmx file disapeared… has no logs like the other vms, and cannot attach vmdk file to a new vm… What causes this?? This is awful

    • Simon Seagrave

      Hi Tom,

      Hmm, that sounds strange indeed. Anything showing in your ESX/ESXi logs at all?

      It sounds like you’ve already tried recreating a new VM with same resource attributes and then pointed the primary VMDK file to your existing VMDK file (whose VMX file is missing) – did I read this right?





    • Pa We

      Hi Tom, I had this problem too (ESXi 5.0), was driving me nuts for days. I could see the vmdk-flat file when browsing the datastore, but it simply didn’t show when I tried to follow the steps here and add a disk to my new VM. I’m still trying to figure out what caused the loss of the vmx files, the only thing I can think of was having an almost-full datastore for a while.

      Anyway, what I had to do was recreate the vmdk descriptor file that should go along with the bigger data file. If it’s missing, the vmdk-flat file with all the data will be missing its normal icon (compare to any healthy VM) and won’t be seen as a disk by ESXi. I found a KB article describing just how to resolve this. The only thing is, because you’re missing the vmx file, you will need to guess your VM’s SCSI connector type correctly :) It was easy for me, because I’ve got several installations of the same OS, and I know that I used the same type. Hope you can figure it out.

      Link to VMware KB article 1002511:

  • Nathan

    Thank you as this saved me a ton of time in getting this machine back up quickly!

  • Tom Berchenbriter

    Nothing in the logs, and I tried creating a new vm and pointing it to the vmdk, but I couldnt get it to see it… Open to suggestions..

  • http://toomeek.waw.pl/blog TooMeeK

    My VMX file is invalid (after ESX 4.0 update) after adding it to invertory.

    Yes, this method is correct, however..
    I’m unable to create NIC with same MAC address as it has before.
    There is no way to create NIC with auto-assigned MAC identical as it was before.

    MAC address poll for auto-created NIC is different from manual-created.

    Hope this helps somebody..

    • noone

      last 6 chars of uuid.

  • aa

    thanks much.you saved me a lot of time.cheers,

  • hmx_ryan

    Thanks man, you save my day..:)

  • Marco


    Do you think that I can do that with the VM powered on ?
    Thans for your help.

  • Joe Chang

    Thank you!

  • Mag

    I know that this is a very old article, but you have just SAVED MY LIFE!!! Thank you so much for having this article up, WITH PICTURES!! Worked perfectly. My circumstances were that I was moving a VM between LUNs, and had a power failure. Somehow the .vmx file went totally missing! It was not in either the original folder or the moved folder. Not sure what happened, but I still had the log files, and without your article would have never known that I could recreate it. This contained all of our work product and would have been absolutely the end of me if lost. THANK YOU THANK YOU THANK YOU!

    • http://techhead.co/ Simon Seagrave (TechHead)

      Hi Mag,

      My pleasure – I’m so pleased the blog post helped you out. I appreciate the feedback.

      All the best,


  • djesu

    Please I want a vmx file for ubuntu. I tried to install ubuntu on vmware to no avail. I will be happy if I get a free .vmx file for ubuntu. I will later make modification for my machone.

  • pitpa

    Hi, I tried but I got the bluescreen while the Windows is loading.

    • http://techhead.co/ Simon Seagrave (TechHead)

      Hi. Was the VM running before, and have you upgraded or changed anything in your environment, eg: VM hardware level, version of vSphere, VMTools, etc?