VMware Communities
prais
Contributor
Contributor
Jump to solution

Help me.Is there a way to repair VMDK file after vmware-vdiskmanager -R says it can not be repaired?

Hello,

My mac restarted while it was cleaning (removing unused space) the virtual machine
So I now have the damaged VMDK file.
I am running 12.2.1 VMware Fusion on macOS.

Unfortunately I don't have the backup.
I attach log.
How can I solve?

0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

I'm not sure what's causing the second command to fail, it should do it's job in a matter of seconds.

Anyway, to workaround that, I've added some dummy pointers into the metadata, so that it matches the current file size. Prior to injecting the attached metadata, please verify that the .vmdk file size is still 229,423,316,992 Bytes.

The inject command is basically the same, except for the source file:
dd if="Metadata-WINDELL-JSALLO4-fixed2.bin" of="WINDELL-JSALLO4.vmdk" bs=1024 count=135424 conv=notrunc

Since I've added pointers to currently unused space in the file, you need to run another cleanup to free up disk space on the host / shrink the .vmdk file.

André

View solution in original post

0 Kudos
20 Replies
a_p_
Leadership
Leadership
Jump to solution

As a first step, and to see what can be done,

  • open a terminal window, and go to the VM's .vmwarevm folder
  • run: ls -l > filelist.txt (to create a file listing, which contains all of the VM's files with their file names, sizes, time stamps, ...)
  • run: dd if="WINDELL-JSALLO4.vmdk" of="Metadata-1536.bin" bs=1536 count=1
  • then compress/zip filelist.txt, an Metadata-1536.bin, and attach the .zip archive to a reply post.

Based on the results, I will then provide you with another dd command, to extract all metadata (no userdata) from the .vmdk file.

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

Hi Andre,

thanks!

Attached what you asked me!

I await new instructions.

0 Kudos
prais
Contributor
Contributor
Jump to solution

I found a very very old backup. I'd rather avoid starting from there.
Even if I don't think it is possible, I point it out because maybe you can do a type of merge.

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Wow, that's a huge virtual disk.

To extract the .vmdk file's complete metadata (header, grain directories, grain tables) please run

dd if="WINDELL-JSALLO4.vmdk" of="Metadata-WINDELL-JSALLO4-229423316992.bin" bs=1024 count=135424

and attach the Metadata file (compressed as a .zip archive) to your next reply.

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

Yes @a_p_  is very big ‌😥‌..
that's why I'm afraid of losing everything ‌😅‌.
In attach the new zip archive.

Thanks!!

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

With the aborted clean operation, it's unpredictable in which exact state the cleanup has been terminated, and I had to make a couple of assumptions to at least fix the metadata, so that the virtual disk should be recognized as such again.

Please extract the "Metadata-WINDELL-JSALLO4-fixed.bin" from the attached .zip archive, copy it to the VM's folder, and run the following two commands.
dd if="Metadata-WINDELL-JSALLO4-fixed.bin" of="WINDELL-JSALLO4.vmdk" bs=1024 count=135424 conv=notrunc
dd if=/dev/null of="WINDELL-JSALLO4.vmdk" bs=1 seek=197558075392 count=1

Line 1 will replace the corrupted metadata
Line 2 will truncate the .vmdk file to the expected size

I strongly recommend that - unless already done - you backup the .vmdk file before making the modifications.
Please note that there's also a chance of file system corruption within the guest OS.

Prior to powering on the VM with the fixed metadata, take a VM snapshot, so that you can revert to it in case it's necessary.

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

the second instruction fails. I've tried twice leaving it all night, but in the morning it's still there. Plus I have to force shutdown the mac after.
While the first instruction is successful.
Uff, can I do anything else?

Thanks in advance

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

I'm not sure what's causing the second command to fail, it should do it's job in a matter of seconds.

Anyway, to workaround that, I've added some dummy pointers into the metadata, so that it matches the current file size. Prior to injecting the attached metadata, please verify that the .vmdk file size is still 229,423,316,992 Bytes.

The inject command is basically the same, except for the source file:
dd if="Metadata-WINDELL-JSALLO4-fixed2.bin" of="WINDELL-JSALLO4.vmdk" bs=1024 count=135424 conv=notrunc

Since I've added pointers to currently unused space in the file, you need to run another cleanup to free up disk space on the host / shrink the .vmdk file.

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

@a_p_ you are my hero!


I followed the instructions with complete trust and the machine was back in operation!
Thank You very much!

0 Kudos
prais
Contributor
Contributor
Jump to solution

@a_p_ a strange thing happens.
I tried to erase everything I could with good results.
But VmWare continues to "eat" space.
I noticed in the folder it is creating other .vmdk.

Above the machine there will be approximately 100gb actually occupied.
How do I solve the problem?
See the screenshot please.

Thanks in advance

0 Kudos
Technogeezer
Immortal
Immortal
Jump to solution

Check to see if you have snapshots (either manually created or auto-enabled). It appears like you might. In which case the disk space will go up because the virtual machine will need space to hold changed data so that it can maintain the snapshot at a given point in time.

 

- Paul (Technogeezer)
Editor of the Unofficial Fusion Companion Guides
0 Kudos
prais
Contributor
Contributor
Jump to solution

@Technogeezer I don't have snapshots nor snapshots are created automatically.
But I took out two this morning.
I see my memory go up.
As soon as I delete something on the Mac, VmWare takes up the space.
How do I resolve all this occupied space?

0 Kudos
Technogeezer
Immortal
Immortal
Jump to solution

@a_p_ would have a better idea on what might be happening here.

You said you have no snapshots, but you look out two this morning. Did you delete 2 snapshots or take 2 snapshots?

Whatever is happening, it looks like new data is being written to files that are normally associated with snapshots. The main VMDK file doesn't appear to have been modified since December 21st.

I am not comfortable running for any length of time on a virtual disk that's been repaired from a corruption incident. Since you don't appear to have snapshots but do appear to have a virtual disk that isn't behaving like you think it should, my advice would be to back up the data in that virtual machine from within the virtual machine, create a new one with a new set of virtual disks and a fresh operating system, and then restore the data you've backed up. Just like you'd do for a physical machine should you have a disk you think is failing. 

In that new virtual machine, create your virtual disk to that it is split into multiple pieces. That will help you better control disk consumption.

Also, plan for the unexpected. If that data is important, regularly back up your virtual machine to other media (not with Time Machine) so that you reduce the risk of total data loss should you experience another incident.

Andre may have other advice, though.

- Paul (Technogeezer)
Editor of the Unofficial Fusion Companion Guides
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

I do agree with @Technogeezer. According to the file listing, the VM has two snapshots, with the first one created - likely because of my recommendation - after we fixed the metadata, but never deleted after verifying the guest. Please remember that deleting the snapshots may temporarily require additional disk space on the host (up to ~75GB, depending on the data in the snapshots).

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

@a_p_ @Technogeezer 

ok i understand this method is the safest, the cleanest and it's the right thing to do.
But in the meantime, how can I try to fix it?

I took a snapshot in December and one this morning.
Then this afternoon I deleted them both but something seems to have gone wrong.
On the virtual machine as I have already said there are 100gb occupied and that's it.
Isn't there a way to try to fix this VM before I can do your suggested procedure?

I also have 4.3gb to recover with the "CleanUp" but it won't let me.

On my mac there are now 16gb free.

Thank you

Tags (1)
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

>>> Then this afternoon I deleted them both but something seems to have gone wrong.
That was likely caused by insufficient free disk space.

Do you have an external HDD/SSD that has at least ~300GB free disk space?

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

@a_p_  Yes, I have Hdd with 500gb free.

I just finished putting the VM folder on top.
How do we go on?

Thanks in advance

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

>>> I just finished putting the VM folder on top.

I was actually thinking of a different approach.
My idea is to create a full clone of the VM from the Fusion UI to the external disk, which should consolidate the snapshots, i.e. result in a VM without snapshots. Next run a cleanup task on the external clone. If everything worked as expected, you could then delete the original VM on the Mac (it's up to you to create another copy/backup before deleting the VM), and finally copy or clone the external VM back to the Mac's internal drive.

André

0 Kudos
prais
Contributor
Contributor
Jump to solution

@a_p_ 

--> "My idea is to create a full clone"

forgive me .. how do you do it?
I looked at the menu but couldn't find the option..

 

0 Kudos