VMware {code} Community
mung1
Contributor
Contributor

How to repair corrupt vmware disk with linux partition on it?

Okay I have a damaged windows disk running vmplayer and linux ubuntu12 on the VM, and amazingly my backup portable hardrive also has corruption so the only thing I can do is try repair.

I have looked at vmware-vdiskmanager and vmwarediskmout but it ooks like they only handle windows virtual disks? link ---> Running the VMware Virtual Disk Manager Utility

The main problem is that vmwareplayer will not allow the vm to run if it thinks there is a problem with the disk so I cannot access the drive at all without getting vmwareplayer to load the system.

So I started playing with things to see what I could do.

The VM had 2 virtual disks only 1 is corrupt, the disks are split as 2Gb sections on a windows system.

So luckily the corrupt drive was not the boot drive so I edit the VM .vmx file and change the config line to remove the corrupt virtual disk ( scsi0:1.present = "FALSE"), so now my VM boots and I can get some of my files back, but still there is a huge amount of important data on the second drive.

The next bit is a terrible hack but it got a little more data off the corrupt virtual disk file, I could see which 2Gb file was corrupt cause the copy had a different file mod date as it could not be correctly copied from the host windows systems disk, so I copied one of the other 2Gb .vmdk files and renamed it to the same as the corrupted file then edit the machine .vmx file back to  ( scsi0:1.present = "TRUE"), and amazingly the is now no problem booting and mounting the linux ext2 drive within the VM. I have started copying off some files but there are a few directorys that have errors filessystem superblock error (obviously dues to the image being totally incorrect) I want to go  further with trying to get as much data as possible restored,

What I need to know is how does vmwareplayer decide a file is corrupted and refuse to run because of it?

Obviously it does not do a perfect check as simply copying one of the other .vmdk files and renaming it allows the VM to boot and access the diskfiles.

I am wondering what the low level layout of the vmdk files is, my guess is if I either reset the timestamp date of the 2gb corruptfile, add some extra blank data to the end of the file to make it the correct size, or modify the first few bytes of the file to have a correct checksum then it will allow access to the file.

The corrupt file obviously should be 2Gb, and shows on the backup as 2,095,488kb the only problem I see is the tamestamp is different to all other .vmdk files.

Anyone have any ideas about how vmware disks can be repaired and how they are structured and error checked?

0 Kudos
3 Replies
a_p_
Leadership
Leadership

Welcome to the Community,

There are different virtual disk formats which can be used. For sparse virtual disk formats (2GB sparse is what I assume you have) the files contain a header and metadata which describe the block structure (see https://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf). Depending on what's corrupted, VMware Player may no tbe able to load/mount the virtual disk.

If you want download dsfok.zip from http://faq.sanbarrow.com/index.php?action=artikel&cat=47&id=111&artlang=en, extract the executables, run the below mentioned command in the VM's folder, then compress/zip the .bin file and attach it to a reply post. I will then take a look at the structure.

dsfo.exe "vmname-s00X.vmdk" 0 327680 "vmname-s00X.bin"

Replace "vmname-s00X" with the name of the corrupted file. The first 320kB only contain metadata, i.e. no user data.

In addition to the extracted data, provide the exact size in bytes of the file.

André

0 Kudos
mung1
Contributor
Contributor


thank you very very much Andre for your helpful offer, I am extremely grateful,


 I ran command as follows:


C:\ubuntuemccompile>dsfo.exe rpi-RT_kernels-s003.vmdk 0 327680 vmdkheader.bin
OK, 327680 bytes, 0.031s, MD5 = 1aca77e2188f52a62674fe8a873bdaba


files size shown from dir in command prompt is 2,145,779,712


I have attached file vmdkheader.bin which is output from command.


 


Many thanks for your time.

C:\ubuntuemccompile>dsfo.exe rpi-RT_kernels-s003.vmdk 0 327680 vmdkheader.bin



OK, 327680 bytes, 0.031s, MD5 = 1aca77e2188f52a62674fe8a873bdaba


0 Kudos
a_p_
Leadership
Leadership

I'm sorry, but there's nothing I can do for you in this case. The file only contains binary zeroes, i.e. no metadata at all.

What you may do is to replace the corrupt file with another "blank" (320kB) .vmdk file (rather than another large data file, what you have already tried) and try to extract/restore as much data as possible. If you don't have a clean/blank .vmdk file, simply create a new temporary VM and replace the "rpi-RT_kernels-s003.vmdk" with one of the 320kB .vmdk files.

André

0 Kudos