VMware Cloud Community
dropadrop
Enthusiast
Enthusiast
Jump to solution

deleted all vm files apart from flat vmdk - recovery?

In some moment of insanity I accidently tried deleting a running virtual machine from a datastore. All files apart from the flat vmdk file where deleted... It's not a critical system, but I would still prefer to recover using the existing vmdk file if possible. Since it's a flat file without the descriptor I can't just use it as a basis for a new virtual machine, so how would you go for recovering it? I believe thin provisioning was not used, so should I just copy it to a linux machine, mount it there and copy relevant files out or can I recover it within esx-i?

Edit: I should probably add that I know the exact size of the disk, but when I try to create new disks I can't seem to manage to get them separated into flat / basic vmdk anymore (with an idea of just using the new disks descriptor for the old one)

0 Kudos
1 Solution

Accepted Solutions
Dave_Mishchenko
Immortal
Immortal
Jump to solution

Take a look over at sanbarrow.com for some details about this kind of issue, but basically you can follow this process

1) Create a new VM with the same disk size as the old one.

2) Copy the descriptor file over to the folder with just the flat.vmdk file left.

3) Edit the descriptor file (.vmdk) and update it to point to the old flat.vmdk file.

4) Kill the VM processes.

5) Edit the new VM and remove the virtual HD.

6) Copy the old file to the new VM folder with vmkfstools.

7) Edit the new VM and add an existing disk file (using the new copy).

😎 Power on the VM.

But before you do this can you

1) verify for us if the VM is still running

2) post a listing of the folder where the VM files were (with the -l option to show file size).

3) Can you confirm which VMware product and version you're using? I'd assume ESXi 3.5 but it would be best to confirm that.




Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

View solution in original post

0 Kudos
7 Replies
Dave_Mishchenko
Immortal
Immortal
Jump to solution

Take a look over at sanbarrow.com for some details about this kind of issue, but basically you can follow this process

1) Create a new VM with the same disk size as the old one.

2) Copy the descriptor file over to the folder with just the flat.vmdk file left.

3) Edit the descriptor file (.vmdk) and update it to point to the old flat.vmdk file.

4) Kill the VM processes.

5) Edit the new VM and remove the virtual HD.

6) Copy the old file to the new VM folder with vmkfstools.

7) Edit the new VM and add an existing disk file (using the new copy).

😎 Power on the VM.

But before you do this can you

1) verify for us if the VM is still running

2) post a listing of the folder where the VM files were (with the -l option to show file size).

3) Can you confirm which VMware product and version you're using? I'd assume ESXi 3.5 but it would be best to confirm that.




Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

0 Kudos
dropadrop
Enthusiast
Enthusiast
Jump to solution

Thanks for the reply. I was trying to recover using the method you mentioned, but I can't see any "flat files" when creating new disks. I can create a new disk which is exactly the same size though. I thought I was running ESX-i 3.5 but just noticed somebody has updated it to 4.0.

The only file I have left in the folder is the flat vmdk file, I attached a screenshot of the old folders listing. The other screenshot is from a new created virtual with the same disk size, I copied the flat file into that datastore.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

can you use winscp to create a screenshot of the files you have ?

For this tasks datastorebrowser is unusable.




___________________________________

VMX-parameters- Workstation FAQ -[ MOA-liveCD|http://sanbarrow.com/moa241.html] - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

dropadrop
Enthusiast
Enthusiast
Jump to solution

I was under the impression that I could not use SSH to browse datastores with ESX-i (I actually have a mac with Fusion and use vsphere client from a windows virtual).

Anyway, I managed to fix the issue, a big thanks to Dave Mishchenko for pointing me towards sanbarrow.com. The site actually had a tool which analyses the flat vmdk file and creates a new descriptor which at least in my case seemed to work just fine.

  • Browse to the datastore, download the flat vmdk file to your local disk

  • Download the "oh_dear_I_lost_my_descriptor" tool and run it against the vmdk file (note, for this to work both files had to be in the same folder)

  • Rename the created vmdk file to be the same as the flat file (without "flat")

  • Create a new virtual machine without any disk (or a disk you will delete later)

  • Copy the flat vmdk file and the new descriptor into that folder (I used the original flat vmdk in the datastore to minimise chance of corruption)

  • Add a new disk and select to use an existing one, choose the descriptor and you are rolling.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Thanks - nice to hear that my little tool is useful 😉




___________________________________

VMX-parameters- Workstation FAQ -[ MOA-liveCD|http://sanbarrow.com/moa241.html] - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
dropadrop
Enthusiast
Enthusiast
Jump to solution

Oh, it's your tool? Then apart from a huge thanks I'll also give you feedback.

As mentioned, I use a windows virtual to run the vsphere client. I don't have a lot of disk allocated on the virtual so I had to download the flat vmdk file to my laptop. I tried running the tool from the windows virtual browsing to the vmdk from the vmware shared folders (RW permissions). It always said it created the descriptor but I could not find it from anywhere (and I'm fairly sure it did not create the file). Finally I added another disk to my virtual, copied the flat vmdk to the windows guest and ran them so the files where in the same folder, this worked well.

So as a suggestion for improvement, it could give the path where it created the descriptor, or make a check after creating to ensure the file really appeared. Smiley Happy

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Hi thanks for feedback

in the first place I made the tool for someone who had often problems with vcb backups where the descriptor was missing.

In that scenario the tools works nice. You copy it into the directory where the flat.vmdk is and run it.

For scenarios where you do not have the flat.vmdk in a convenient environment it would be best to simply ask for the exact filesize.

The tool now reads the filesize by checking the flat.vmdk size directly - but thats not convenient sometimes.

If I am in the mood I create an update with some more options Smiley Wink

Ulli




___________________________________

VMX-parameters- Workstation FAQ -[ MOA-liveCD|http://sanbarrow.com/moa241.html] - VM-Sickbay


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...