How can I repair damaged VHD files?

VHD file structure - Repair damaged VHD

I have a damaged VHD that I need to get data from. It is a Windows 2003 x32 Hyper-V virtual machine (NTFS). I have a nearly identical version of this VM without the data that works.

Using a hex editor, I tried to insert the old vhd into the working one after a few pages (comparing arbitrarily) but it seems like it is not working.

It would be ideal to know the VHD file structure so that I could know where the FAT is, where the VM header is, etc. so that I can insert the bytes intelligently.

Does anyone have experience with it?


@ Adam-Brand: Were you able to choose the format of your drive? I have a vhd that was corrupted by VirtualBox and need to get it fixed. There is only data on the drive, so there is no need to start an operating system. I have a hex editor and have played around with it, but no luck so far. I received an event log that said the disk footer signature is invalid but looks fine in hex compared to a previous copy of the same disk. Any thoughts or directions would be awesome!

Not sure whether to fix the actual hard drive or the details of the VHD container format. However, if you haven't tried to properly install the virtual server environment, it might be worth a try.

Apparently WinImage can provide VHD containers:

You can try opening it with VirtualBox. Or, purchase a VMware product and convert it using VMware vCenter Converter. There is a chance one of these products could make up for the errors.

Another option is to use partition / hard drive recovery software. Although the hard drive is virtual, it should respond the same to recovery software.