Any tool that repairs a corrupted VDI file?

Discussions related to using VirtualBox on Windows hosts.
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

Wanted to try all of this. Apparently, my VDI file is inaccessible. Cant create a clone. Cant even create a copy in the same or different folder. Cant open it with Frhed or with any other bin or text editor. Frhed says error while reading from file. CloneVDI also not reading it. Any comments would be appreciated.

Code: Select all

VDI: error reading pre-header in 'D:\VMWARE VIRTUAL MACHINES\VIRTUAL BOX\W8\W8.vdi' (VERR_UNRESOLVED_ERROR).
VD: error VERR_VD_VDI_INVALID_HEADER opening image file 'D:\VMWARE VIRTUAL MACHINES\VIRTUAL BOX\W8\W8.vdi' (VERR_VD_VDI_INVALID_HEADER).
Failed to open image 'D:\VMWARE VIRTUAL MACHINES\VIRTUAL BOX\W8\W8.vdi' in read-write mode (VERR_VD_VDI_INVALID_HEADER).
Failed to attach driver below us! VDI: Invalid image file header. (VERR_VD_VDI_INVALID_HEADER).
AHCI: Failed to attach drive to Port0 (VERR_VD_VDI_INVALID_HEADER).

Result Code: E_FAIL (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

If the current version of CloneVDI doesn't offer you a repair option then the VDI can't be repaired. Only restoring from a backup will fix it.

I find the naming scheme of the folder curious. "VMWARE VIRTUAL MACHINES"? Using VDIs? If you explain how you changed a VMDK to a VDI then perhaps the reason for the corruption may become clear, and even suggest a cure.

Also, if CloneVDI gave you an explicit error message then it would be nice to hear it.
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

Please dont worry about the folder name. Initially I had decided to use VMWARE but later decided not to and never changed the name of the folder. All the machines in it are VDI's. CloneVDI shows "Got OS error 0 when reading from source file" in the validation results. And after a long time, here is what it says:
"The VDi failed header validation checks and would normally be considered unreadable. CloneVDI can attempt to infer a new header but this may not work and could result in total failure or a badly corrupted clone. You should test the clone thoroughly before relying on it."
Last edited by socratis on 2. Sep 2019, 20:34, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

Chaudhry wrote:CloneVDI shows "Got OS error 0 when reading from source file" in the validation results.
Yeah, I keep meaning to fix that error message. However "OS error 0" means that it reached the end of the file unexpectedly, i.e. it's not a hard I/O error, the data is simply incomplete.

A truncated VDI is often the result of copying files via FAT formatted drives, as the FATx filesystem does not support files larger than 4GB.

Obviously there is no fix for data that simply isn't there.
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

mpack wrote:Obviously there is no fix for data that simply isn't there.
You just broke my heart! :(

Thank you for replying and looking into it though.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

So far we only have speculation, you have not confirmed any of it. Was the file indeed transported on a FAT formatted drive? Has the file therefore been truncated at 4GB? If so then how big a data loss does that represent, and is an original (not truncated) copy still available?
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

None of the above. The VM was running and I was working on it. It froze and eventually terminated. I was never able to restart it. The size on the disk is 50GB fixed. However, only 20-30 was under use and rest was free space. I cant remember how much exactly. The file was never transported anywhere. It is still where it was originally started and created. As a matter of fact, it does not even allow a copy operation on it.
Last edited by socratis on 2. Sep 2019, 20:37, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

Chaudhry wrote:As a matter of fact, it does not even allow a copy operation on it.
Can you expand on that? Are we talking about a permissions problem, i.e. behaving as if locked by some process (a reboot should fix), or are we talking about a hard disk error? If the latter than I wouldn't expect CloneVDI to report an OS error of 0.

Oh, and what kind of drive is drive D? Is that a second internal drive, an external USB drive, a network share?
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

drive D is the second partition on the same hard drive having C as the main one. It is internal not an external one. Not a permission problem. More like a hard drive error. Tried rebooting and safe mode. Did Not work. Other VDI's are accessible but just not this one. If I try to view the headers of other VDI's using Frhed or some other editor, they show. But for this VDI, nothing is accessible. Not even the first 1000 bytes nor less.
Last edited by socratis on 3. Sep 2019, 14:15, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

Yes, that sounds like dead sectors beneath the first few K of the file.

It is possible that error the only affects <= the first 1MB of the VDI file, i.e. just the header. If you can find a file copy tool that ignores the early errors (replace with zeros say) and copies the rest, then CloneVDI may still be able to repair the copied VDI.

I would then run chkdsk in thorough surface scan mode, leave overnight to let the OS mark bad sectors. Possibly consider replacing the drive.
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

I will try that. I''m thinking of trying PowerISO again. Will let you know how it goes. The problem is, checkdisk is not identifying any problems or bad sectors. I might need to go through a third party app.
Last edited by socratis on 3. Sep 2019, 14:17, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

If the OS can't even copy the file then I doubt that PowerISO is going to give you any success. If it has a repair function for VDI's with broken headers then I've never heard anyone mention it!
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

No it doesn't repair the VDI. It actually has the functionality of allowing access to materials inside the VDI. Not sure if it'll be of any help in my case as the VDI is inaccessible.
Last edited by socratis on 5. Sep 2019, 13:54, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Any tool that repairs a corrupted VDI file?

Post by mpack »

Chaudhry wrote: It actually has the functionality of allowing access to materials inside the VDI. Not sure if it'll be of any help in my case as the VDI is inaccessible.
I'm pretty sure that before mounting the internal filesystem it first has to open the VDI, which it won't be able to do without a header.

Really, you only have two options: one is to restore the VDI from a backup, which I guess you don't have. The other is to copy the VDI regardless of errors and hope that CloneVDI will accept the corrupted copy. That will all depend on how extensive the corruption is, i.e. does it affect more than the first 1MB of the file, and was the file truncated as CloneVDI previously reported.
Chaudhry
Posts: 10
Joined: 2. Sep 2019, 11:35

Re: Any tool that repairs a corrupted VDI file?

Post by Chaudhry »

Finally able to get this up and running. For readers benefit, I'll explain what I did. Similar to something that you have mentioned above. I didn't have any backup and neither was the system allowing me to copy or move the file. I used 'Roadkil's Unstoppable Copier' to forcefully copy the file despite the errors. It showed around 1.4Mb of the file was corrupt and about 3000 failed read attempts on the VDI file. Finally After 30+ hours, the VDI was copied. I fed that copy to CloneVDI which accepted and created the clone. I removed the original VDI from VirtualBox and replaced it with the clone and WALAAA!!! It worked.
Last edited by socratis on 5. Sep 2019, 13:54, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
Post Reply