TechHead

Virtualization blog also covering Cloud, Windows & Tech how-to

  • Home
  • Blog Categories
    • VMware
      • VMware “How To” Posts
      • VMware Troubleshooting
      • VMware Workstation & Fusion
      • VMware Backup & Replication
      • VMware vCloud Director
      • VMware Certification
      • VMware Horizon
      • VMware PowerCLI
      • VMware Security
      • VMware Training
      • VMware User Group & Community
      • VMware View
      • VMworld
      • VMware Useful Links
    • EMC
      • Virtual Storage Appliance (VSA)
      • vSphere VSI Plugin
    • HP
      • Proliant Servers
    • Microsoft
      • MS Windows Server
      • MS Hyper-V
      • MS Exchange
      • MS SQL Server
      • MS PowerShell
    • General Tech
    • Cloud
    • Networking
    • Iomega
    • Apple
    • Cisco
    • Linux
    • Internet & Web
    • WordPress
  • About Me
  • Home Labs
  • VMware Tools
  • Crypto Links
  • Cool Tech Links
  • Recommended Podcasts
    • vChat Podcast Episodes
You are here: Home / VMware / VMware ESX – How to easily recreate a missing or corrupt VMX file.

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

by Simon Seagrave 32 Comments

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’. 

image

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.

image 

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.

image

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. 

image

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.

image

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.

vmxfile

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

 

Technorati Tags: VMware,ESXi,ESX,3.5,recreate,fix,repair,VMX,file,configuration,easy

Why not take a look at my other related posts?:

  1. VMware ESX – “Unable to access a file since it is locked”
  2. VMWare ESX – A Good Fast File Copy Utility and Replacement to SCP.
  3. How to a add or import a Template into VMware Virtual Center v2.5
  4. VMWare ESX – 'Warning: Windows customization resources were not found on this server'.

Filed Under: VMware

About Simon Seagrave

Simon is a UK based Virtualization, Cloud & IT Technology Evangelist working as a Senior Technology Consultant and vSpecialist for EMC. He loves working in the ever changing IT industry & spends most of his time working with Virtualization, Cloud & other Enterprise IT based technologies, in particular VMware, EMC and HP products.

As well as on this site, you can find him on Twitter and Google+

Comments

  1. Marino Duregon says

    16 April 2010 at 6:13 am

    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.

    regards

    Reply
    • Chris says

      13 October 2014 at 4:45 pm

      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/

      Reply
      • Simon Seagrave (TechHead) says

        24 November 2014 at 8:29 pm

        Hi Chris,

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

        Cheers,

        Simon

        Reply
  2. Kunal says

    20 August 2010 at 1:39 pm

    Thanks..you saved my life 🙂

    Reply
    • Kunal says

      20 August 2010 at 1:58 pm

      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!!

      Reply
  3. Larow says

    25 March 2011 at 5:03 am

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

    Reply
    • Kiwi Si says

      28 March 2011 at 8:37 am

      Hi Larow,

      Glad it helped 🙂

      All the best,

      Simon

      Reply
  4. Ed says

    25 March 2011 at 2:51 pm

    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?

    Ed

    Reply
  5. Tom Berchenbriter says

    14 December 2011 at 4:01 pm

    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

    Reply
    • Simon Seagrave says

      21 December 2011 at 1:31 pm

      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?

      Cheers,

      Simon

      Cheers,

      Simon

      Reply
    • Pa We says

      20 November 2012 at 1:27 am

      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:
      http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002511

      Reply
  6. Nathan says

    15 December 2011 at 7:57 pm

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

    Reply
  7. Tom Berchenbriter says

    21 December 2011 at 2:28 pm

    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..

    Reply
  8. TooMeeK says

    29 December 2011 at 1:54 pm

    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..

    Reply
    • noone says

      2 July 2013 at 1:47 am

      last 6 chars of uuid.

      Reply
  9. aa says

    26 January 2012 at 8:45 am

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

    Reply
  10. hmx_ryan says

    26 April 2012 at 12:16 am

    Thanks man, you save my day..:)

    Reply
  11. Marco says

    22 May 2012 at 9:57 pm

    Hello

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

    Reply
  12. Joe Chang says

    16 January 2013 at 1:07 am

    Thank you!

    Reply
  13. Mag says

    5 October 2013 at 4:15 pm

    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!

    Reply
    • Simon Seagrave (TechHead) says

      12 October 2013 at 9:35 am

      Hi Mag,

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

      All the best,

      Simon

      Reply
  14. djesu says

    13 November 2014 at 6:19 pm

    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.

    Reply
  15. pitpa says

    26 January 2015 at 12:46 pm

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

    Reply
    • Simon Seagrave (TechHead) says

      26 January 2015 at 1:19 pm

      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?

      Reply
  16. Gavin says

    7 April 2015 at 7:09 pm

    I don’t normally comment on articles like this, but you really saved my neck! For Mac users, this also works for us as well.
    The steps are different in that you:
    1. Select custom installation
    2. Continue without disk
    3. Use an existing virtual disk
    4. Find your VM where it is stored
    5. Show package contents
    6. Select the VMDX file
    7. Then proceed with installation as you would normally.

    Thanks again, Simon!

    Reply
    • Simon Seagrave says

      7 April 2015 at 9:06 pm

      Hi Gavin,

      Thanks for the feedback, so glad you found it of use. 🙂

      Also, thanks for the steps for Mac users, that’ll no doubt come in useful for others.

      All the best,

      Simon

      Reply
  17. Philippe says

    13 April 2015 at 8:01 pm

    I have tried rebuilding the .VMX file using this method, however when i click browse and open the folder where the .vmdk files are located, no files are shown.
    I am running ESXi 4.1.
    Any suggestion ?

    Reply
    • Ray says

      10 June 2015 at 8:16 pm

      I am having exactly same issue. Any ideas?

      Reply
  18. Shakey says

    14 December 2015 at 5:07 am

    Thank you, I spent ages trying to find a fix and this was so quick and easy 🙂

    Reply
  19. Casey says

    3 March 2016 at 10:43 pm

    My problem was an error with the VMX file. Couldn’t power on, couldn’t migrate, couldn’t download the folder using the client. Sadly this was happening during a near catastrophic SAN failure and I had been up for days and I wasn’t of my right mind when I came accros this article and followed it without much thought. If you’re reading this I would encourage you to go for a walk and clear your head before you make a mistake.

    Couple of comments on the fall-out I experienced after doing this and what mistake I made.

    First, the mistake was that the server in question had there hard drives, In my haste, I missed that someone had created a snapshot some 2 1/2 years ago. So I can tell you that should you have a snapshot and do this, the delta VMDK for each of your disks per snapshot if you have more, will not be linked to the new VM your create and after scratching your head you will understand why a printer server role is missing and your end-users cannot print.

    Next, if you do use the same folder as suggested, even if you rename any files you want to be there as a failsafe, that some of them will get deleted by this process. Also, even if you make it exactly the same name, you could end up with an additional “_1” folder which was my experience on 5.1 even though I copied the name to the clipboard right before doing this.

    If you cannot get a copy or you don’t have a recent backup and you’re in my shoes, I would consider contacting support. At a minimum I would suggest trying to merge your snapshots and should that fail, really do call support. The dark road of CID mismatches and even more errors follow. As it stands I haven’t found a path though the forest for this particular server to get it back to the way it is suppose to be.

    Food for thought,

    Reply
  20. Jorge says

    7 July 2017 at 6:33 pm

    Is more easy move the Vm to other Datastore. In the new datastore, vmxf file is created new

    Reply
  21. aldrin says

    9 August 2017 at 8:02 am

    Is it normal that when i’ve done the process the state of the VM that will retain was only base on my updated snapshot?

    Thanks

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Looking For Something?

Site Sponsors

Click here to become a sponsor

More TechHead Goodness

Awards

VMware vExpert 2016

About Me

Simon Seagrave - TechHead - VMware EMC HP IT Tech Blogger My name is Simon Seagrave and I am a Massachusetts (ex UK) based Technical Marketing Consultant working for Dell EMC. I love my work & spend most of my time working with Virtualisation & other Enterprise IT based technologies, in particular VMware, EMC and Dell products. I am a VMware vExpert (2009 - Present).

Recent Post Comments

  • vikas khandola on How to copy or move files and folders whilst maintaining their original time date stamp.
  • JF on Introduction to Cisco VLANs
  • John K on "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host
  • Simon Seagrave on "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host
  • Jawad Ehsani on "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host

Techhead Poll

Do you run a home lab?
View Results

Featured TechHead Video

Recent Posts

  • [Podcast] vChat Episode 45–Things Crypto-Currency and Crypto-Mining
  • [Link] Dell EMC Interactive Demos
  • "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host
  • Changing Hosts File – Unable to set new owner on hosts. Access is denied.
  • vChat Podcast #42 – First Steps in Coding with Dan Appleman

TechHead on Facebook

EZ Fat Footer #1

This is Dynamik Widget Area. You can add content to this area by going to Appearance > Widgets in your WordPress Dashboard and adding new widgets to this area.

EZ Fat Footer #2

This is Dynamik Widget Area. You can add content to this area by going to Appearance > Widgets in your WordPress Dashboard and adding new widgets to this area.

Copyright © 2018 · Dynamik Website Builder on Genesis Framework · WordPress · Log in

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok