VMware Cloud Community
rafako1000
Contributor
Contributor
Jump to solution

Restore VM from flat and delta .vmdk files

Hello VMware community. I use VMware ESXI free 6.5.

Yestarday I unfortunately try to perform VMs backup with one of the free scripts, after some error I decided to reboot ESXI. After this operation all .vmx and machine.vmdk files dissapered.

I have only machine-flat.vmdk and machine-delta.vmdk. As I understand delta file is growing snapshot over flat?  I've successfully recovered .vmdk file from 'flat' (and .vmx after that) with help from this topic, but it is raw system image(without my data). I think that I should merge flat and delta in some way, after that generate new machine.vdmk but I can't find if it is possible and how to do that.

I will be grateful for any help.

Reply
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

Snapshots in VMware products work like chains, so what's required is to recreate the correct chain, and link the configuration (.vmx) file to the newest snapshot. I've created the chain according to the delta files's time stamps.

So what you want to do is to unzip the attached .zip archive and upload the files to the appropriate datastores. Then either remove the VM from the ESXi host's inventory, and re-add it again, or reload the .vmx file from the command line (see https://kb.vmware.com/s/article/1026043​).

To avoid modifications to the existing files, I'd recommend that you take another snapshot prior to powering on the VM.

Since you've powered on the VM from the flat.vmdk file, you may experience some data corruption, because some data blocks have been modified in this file.

Please note that I've named the descriptor .vmdk files to match the flat/delta file names. This means that you will need to delete your own created descriptor dnshole.vmdk file. CAUTION: Do NOT try to delete this file from the datastore browser. You'll have to delete it from the command line! Deleting a .vmdk file from the GUI may delete its associated flat/delta file too.

André

View solution in original post

5 Replies
a_p_
Leadership
Leadership
Jump to solution

Welcome to the Community,

please run ls -lisa in the VM's folder, and paste the text output to a reply post. Also attach the VM's configuration (.vmx) file as well as the .vmdk descriptor file which you have already created.

André

Reply
0 Kudos
rafako1000
Contributor
Contributor
Jump to solution

ls -lisa from old directory

117457476      8 drwxr-xr-x    1 root     root           980 Jul 20 12:24 .
      4   1024 drwxr-xr-t    1 root     root          2520 Jul 20 12:24 ..
167789124 2573312 -rw-------    1 root     root     2634231808 Feb 16 14:26 dnshole_0-000001-delta.vmdk
188760644 24773632 -rw-------    1 root     root     25367359488 Jul 19 19:08 dnshole_0-000002-delta.vmdk
243286596 115712 -rw-------    1 root     root     117649408 Jul 19 19:43 dnshole_0-000003-delta.vmdk
125846084 27734016 -rw-------    1 root     root     107374182400 Jul 20 12:26 dnshole_0-flat.vmdk
176177732      0 -rw-------    1 root     root           553 Jul 20 12:24 dnshole_0.vmdk
I restored here dnshole_0.vmdk from dnshole_0-flat.vmdk. Later I create new VM with the same name (stopping vpxa to perform), listing below. I think important is that flat.vmdk file modification date before creating .vmdk was 13 Feb - and after run new machine I get this date state.

total 4310040
180372036      8 drwxr-xr-x    1 root     root          1400 Jul 20 12:24 .
      4   1024 drwxr-xr-t    1 root     root          2520 Jul 20 12:24 ..
213926468 4194304 -rw-------    1 root     root     4294967296 Jul 20 12:24 dnshole_1-aa49c04b.vswp
218120772   1024 -rw-------    1 root     root          8684 Jul 20 12:25 dnshole_1.nvram
192954948      0 -rw-r--r--    1 root     root             0 Jul 20 12:24 dnshole_1.vmsd
184566340      8 -rwxr-xr-x    1 root     root          3189 Jul 20 12:24 dnshole_1.vmx
201343556      0 -rw-------    1 root     root             0 Jul 20 12:24 dnshole_1.vmx.lck
205537860      8 -rwxr-xr-x    1 root     root          3151 Jul 20 12:24 dnshole_1.vmx~
209732164   1024 -rw-r--r--    1 root     root        192774 Jul 20 12:31 vmware.log
197149252 112640 -rw-------    1 root     root     115343360 Jul 20 12:24 vmx-dnshole_1-2856960075-1.vswp

Summary: I had only dnshole_0-flat.vmdk I restored both: dnshole_0-.vmdk and later attach them to new configuration via web configurator to get dnshole_1.vmx.

What I want to achive is restore -delta files from old VM. Thank you very much

Progress

I find that I could create new snapshot with command line, next removeall and get all merged to flat. But when I try this, the delta-4 is created, when I do removeall delta-4 is merged to flat, when old delats with real data stay.

Reply
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Snapshots in VMware products work like chains, so what's required is to recreate the correct chain, and link the configuration (.vmx) file to the newest snapshot. I've created the chain according to the delta files's time stamps.

So what you want to do is to unzip the attached .zip archive and upload the files to the appropriate datastores. Then either remove the VM from the ESXi host's inventory, and re-add it again, or reload the .vmx file from the command line (see https://kb.vmware.com/s/article/1026043​).

To avoid modifications to the existing files, I'd recommend that you take another snapshot prior to powering on the VM.

Since you've powered on the VM from the flat.vmdk file, you may experience some data corruption, because some data blocks have been modified in this file.

Please note that I've named the descriptor .vmdk files to match the flat/delta file names. This means that you will need to delete your own created descriptor dnshole.vmdk file. CAUTION: Do NOT try to delete this file from the datastore browser. You'll have to delete it from the command line! Deleting a .vmdk file from the GUI may delete its associated flat/delta file too.

André

rafako1000
Contributor
Contributor
Jump to solution

That is perfect. Thank you very much. For now I didn't discovered any data corruption so I'm only happier.

Reply
0 Kudos
BingyBam
Contributor
Contributor
Jump to solution

To your notice, there is a much easier and faster way to resolve the given problem you got. You don't have to recreate the correct chain and link the configuration (.vmx) file to the newest snapshot. I was going mad trying how to understand how to fix the issue when I bumped into it. Check this out https://www.diskinternals.com/vmfs-recovery/recover-vm-from-flat-vmdk-the-best-solutions/ The best part is that I read what they had to say and I understood what is going on. Thank god they have a brilliant trial version, saved me.

Reply
0 Kudos