VMware vSphere

 View Only
  • 1.  Accidentally deleted .vmx file

    Posted Jun 24, 2011 07:39 AM

    Dear all,

    I was cleaning up my datastore today, deleting some duplicated files which were created after many failed migrations. However while doing so, I must have gotten confused and accidentally deleted a powered on VM. All the files are missing now.

    However, I noticed I had another folder (which I do not know where it came from) which somehow contained a vswp file, vmdb-flat.vmdk and vmdb_1-flat.vmdk but just this 3 files. (Basically the folder which I had deleted was my database VM.)

    Strange enough, I went to my database enterprise manager URL and I could still access it. Everything was fine. But when I went to my vmdb VM on my inventory list in vSphere client, I am no longer able to power on my VM at all.

    What do I do now? Unfortunately, there isn't any backups made.. I can still access my VM via ssh but not via vSphere client. :smileyconfused:



  • 2.  RE: Accidentally deleted .vmx file



  • 3.  RE: Accidentally deleted .vmx file

    Posted Jun 24, 2011 08:45 AM

    If your vmdks still exist, you could just create a new VM (with no disks) then under machine settings add the existing vmdks as new disks to the new VM.

    as long as you get the VM hardware about the same, it should work.

    The only catch is that your new VMNic will have a new MacAddress - so be seen as a new adapter and you'll need to reconfigure your IP settings.



  • 4.  RE: Accidentally deleted .vmx file

    Posted Jun 25, 2011 05:05 PM

    As written vmx has the VM configuration... so could be simple to create a new one (exept the MAC address, but you can manually force it...).

    If you have delete also the small .vmdk file, this has the disk description and is a little more complicate di create.

    A simple way is build a new disk with the SAME size and replate the -flat.vmdk with your file.

    Andre



  • 5.  RE: Accidentally deleted .vmx file

    Posted Jun 25, 2011 06:11 PM

    You have to be careful to not loose data in such a case. The good thing is that the two flat.vmdk files (it looks like you had two virtual disks mapped to the VM) were locked while the VM was running, so they could not be deleted. However you may not be able to power off the VM gracefully without the missing files. What I suggest is to stop (an temporarily disable) at least the database services, to have a consistent state if you need to reset/hard power off the VM. Once powered off, I strongly recommend you backup the files!

    Then you need to recreate the vmdk header/descriptor files (see e.g. http://kb.vmware.com/kb/1002511). Each virtual disk usually consists of two files, the descriptor file (<vmname>.vmdk) and the data file (<vmname>-flat.vmdk) or - in case of a snapshot - a delta vmdk file.

    Once you have recreated the vmdk header files, create a new VM and attach the existing virtual disks, instead of creating new ones. Since the MAC address of the new VM will be different, you may need to reconfigure the network settings in the VM (that's why I suggested to disable the services previously).

    If you have any questions please feel free to ask.

    André



  • 6.  RE: Accidentally deleted .vmx file

    Posted Jun 26, 2011 02:03 AM

    If it just the vmx and the virtual disks are still good as posted you should be able to just create a new VM (redoing all the settings) and point it to the existing virtual disk.

    www.thevirtualheadline.com



  • 7.  RE: Accidentally deleted .vmx file

    Posted Jun 27, 2011 01:47 AM

    Dear all,

    Firstly, thank you for all the help given. Unfortunately, I am not able to recreate my vmx pointing to an existing disk as my vmdk is not being recognised as a valid vmdk file. In my databrowser, my .vmdk is listed as type File as opposed to type Virtual Disk.

    Strangely, I am still able to power off and power on my VM however doing so via command line only: vim-cmd vmsvc/power.on <vid>

    Nevertheless, I would still like to access my VM via console and right now, things look quite bleak.

    Is there still hope in recovering my VM?



  • 8.  RE: Accidentally deleted .vmx file

    Posted Jun 27, 2011 02:28 AM

    Did you do what a.p. asked you to try?  It sounds like your VMDK files are missing there header files.  The data should still be there.



  • 9.  RE: Accidentally deleted .vmx file

    Posted Jun 27, 2011 03:43 AM

    Ok, I've finally resolved this issue by following the instructions here:

    http://hyperinfo.wordpress.com/2008/06/24/recreating-missing-vmdk-descriptor-files/

    Now I can finally have a good night's sleep again... -phew-

    Many thanks to all for the advices and help!



  • 10.  RE: Accidentally deleted .vmx file

    Posted Jul 01, 2011 02:36 AM

    Good to hear you resolved your issue.

    www.thevirtualheadline.com