vCenter

 View Only
  • 1.  Ineed some help recovering VMDK file.

    Posted Mar 22, 2014 09:20 AM

    A few weeks ago, my VCenter Server had a snapshot that was so large that it corrupted my VM while trying to remove it. I decided I could just reload the VM as it was only Virtual Center Server. However, I wanted to save one drive as it had some important information. I copied the vmdk to another datastore and reloaded my VM.  Then I tried to access the saved VMDK by adding it as a new hard drive. This fails with error:  Failed to Lock the file myfile.vmdk  Cannot open the disk myfile.vmdk or one of the snapshot disks it depends on. 

    My server is on a closed network and I am unable to attach the log files.

    I tired searching the net but have been unable to find a solution. 

    Thanks in advance to whomever can help me.



  • 2.  RE: Ineed some help recovering VMDK file.

    Posted Mar 22, 2014 05:23 PM

    Welcome to the Community,

    without any logs or metadata files it's not easy to help, but let's see what's possible.

    Basically each virtual disk (parent disk as well as snapshot disks) consists of two files, although you will only see one in the datastore browser. To see all of the files you need to access the datastore via e.g. WinSCP. The data files have "flat" or "delta" in their names, whereas the metadata/descriptor files are named <vmname>.vmdk for the parent disk, and <vmname>-00000x.vmdk for snapshot disks. What's important, is to understand how these files are chained together. Each of the snapshot metadata files have entries for their parent disks ("parentFileNameHint" as well as "parentCID"). It's necessary that the "parentCID" matches to "CID" of its parent virtual disk file, and that the .vmdk metadata/descriptor file name for the most recent snapshot (the last one in the chain) is used in the VM's configuration.

    André



  • 3.  RE: Ineed some help recovering VMDK file.

    Posted Mar 23, 2014 08:46 AM

    Andre,

    thank you for the informaiton.  I am going to go out on a limb here and say I have really messed by saving only the one vmdk file.  Because the datastore where the vm was stored ran out of space.. the snapshot grew to large.. and to reload it, I removed all the other files after saving the vmdk off to another datastore. 

    thanks for your time and help.

    Annetta



  • 4.  RE: Ineed some help recovering VMDK file.

    Broadcom Employee
    Posted Mar 23, 2014 04:44 PM

    Hi AnnettaC,

    To further explain Andre's reply. You can restore os re-use the file in this scenario only when you have the parent vmdk. If you have parent vmdk and deleted the snapshot disks then also by modifying the parent vmdk descriptor file we would be able to restore/reuse the parent disk. But if the parent disk is deleted and you are left with snapshot files then it will not be possible to reuse it (as it depends on the parent disk). So in short parent disks can be used withtout the snapshot disks, but same is not true for snapshot disk.

    So depends which vmdk file you deleted. Depending on that we can restore or can not restore.



  • 5.  RE: Ineed some help recovering VMDK file.

    Posted Mar 24, 2014 04:54 AM

    saja1,

    After reading Andre's reply, I do not know which file I actually have. The parent or the snaphot.  The file have is named <vmname>_2.vmdk. I do not have anything with <delta> or <flat> in the file name.  It was thin provisioned and looks to be 14GB used of 200GB provisioned. It should have been the 2nd disk of three.  If I  have the parent and you can help me recover it I will really appreciate it.



  • 6.  RE: Ineed some help recovering VMDK file.

    Broadcom Employee
    Posted Mar 24, 2014 06:48 AM

    Hello AnnettaC,

    Please check the following KB articles on same:

    VMware KB: Recreating a missing virtual disk (VMDK) descriptor file for delta disks

    VMware KB: Recreating a missing virtual machine disk descriptor file

    The above would give you some idea about how these works.

    In short you will not be able to see them from the Datastore browser view. You need to go to command prompt (SSH or Direct Console). From there go to the Datastore directory which contains the VM files. Now there if you run "ls -l" or simple ls you would be able to see both the files. For example of a VM named example, you should be able to see the following two files (assuming there is only one disk).

    example.vmdk   -------> this is in KB only and called the descriptor file

    example-flat.vmdk -----> this is the actual data file which holds the data and would be equal to the disk size (if thin provisioned then equal to actual size, otherwise full disk size).

    So you need to check the vmdk (descriptor) file only (if it exists).

    It should have two fields CID and parentCID. CID is the ID of the file itself and the parentCID is the CID of the parent file.

    In case the file itself is parent disk then parentCID field would always be ffffffff.

    If the vmdk file has snapshots then the second disk in chain would have CID of the parent disk as the parentCID in the filed.

    So now you need to check this descriptor file to determine the state.

    Hope this is clear now.



  • 7.  RE: Ineed some help recovering VMDK file.

    Posted Mar 24, 2014 02:21 PM

    Hi Saja1,

    I have read these KBs but I am unsure how to connect to my datastore with WINSCP.  when I try to connect I get connection refused.  I will continue to try to access and reply back with my results.

    Thanks

    annettac



  • 8.  RE: Ineed some help recovering VMDK file.

    Broadcom Employee
    Posted Mar 24, 2014 03:54 PM

    Hello AnnettaC,

    You can transfer file to and from ESXi host using WinSCP. To access it you need something like putty.

    From the Direct Console of ESXi, login and go to Troubleshooting Option --> Enable SSH or Enable ESXi Shell

    Once you enable SSH, then you can use Putty to SSH to ESXi host. Once you are connected to ESXi host through Putty then you can access the files.



  • 9.  RE: Ineed some help recovering VMDK file.

    Posted Mar 24, 2014 03:59 PM

    OK.  I didn't think of this.  SSH is already enabled. I just need to go to the server room tomorrow and check it out.

    Thanks for all your help!



  • 10.  RE: Ineed some help recovering VMDK file.

    Posted Apr 02, 2014 11:16 AM

    Sajal1,

    I was able to log in and search the datastore but did not find my files.  I have given up on try to recover them but I thank you and Andre for your help.  Next time I will be more careful with my deleting..

    AnnettaC