Error VERR_VD_VDI_INVALID_HEADER

Discussions related to using VirtualBox on Windows hosts.

Error VERR_VD_VDI_INVALID_HEADER

Postby PetrHekr » 23. Mar 2014, 01:30

I get this error for my VDI drive. When I look at overall information of my Ubuntu guest, then I can see my disc is shown as inaccessible. In Settings > Storage my disc is attached to Controller SATA and there is full error indicated (shortened): Could not open the medium 'C. VDI: Invalid header in 'C. VERR_VD_VDI_INVALID_HEADER. VD: error VERR_VD_VDI_INVALID_HEADER opening image file 'C.

Any idea how to get my files? Thanks.
PetrHekr
 
Posts: 9
Joined: 23. Mar 2014, 01:14

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 23. Mar 2014, 13:57

The message means that the referenced VDI is corrupted, or is not a VDI. Or possibly the VDI just doesn't exist, though I'd expect a "not found" error in that case.

Also, what exactly is "C." supposed to be? That is not a valid path to... anything. I might suspect xml corruption, except that there's no way the path would be the only thing damaged. Have you been manually editing paths in .vbox files? Have you misquoted the error message?
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby PetrHekr » 23. Mar 2014, 19:25

Path to the VDI is correct. The VDI itself looks to be corrupted, respectively its header. What are the possibilities to recover corrupted VDI in case of a broken header?
PetrHekr
 
Posts: 9
Joined: 23. Mar 2014, 01:14

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 24. Mar 2014, 00:30

"C." is not a path, so it's hard to imagine the circumstances in which it could be called correct.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby PetrHekr » 24. Mar 2014, 10:03

Actually I've shortened error message in previous post. Please see the image bellow for full message with proper path. When I attach this VDI to another virtual machine, then error message is totally the same.

Now I remember that I had to run chdisk on my host machine (Win7) before. Maybe it has made some minor change in VDI file in order to fix some problems with physical HDD?

Image
PetrHekr
 
Posts: 9
Joined: 23. Mar 2014, 01:14

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 24. Mar 2014, 13:08

Ok, so you did misquote the error message, thanks. That clears that up.

We are left with file corruption as the only explanation of the message.

  1. Have you done anything unusual with this file, for example is it a copy taken from elsewhere?
  2. If yes to Q1, how was the copy made, how was it transported?
  3. Has this file ever worked in its current location?
  4. If yes to the last question, I take it you do not have a backup of this VDI file?
I would be interested in seeing a hex dump of (lets say) the first 10K bytes of this VDI file. To create that, partially load the file in frHed (or any hex editor you're familiar with), save the first 10k to a file, then zip that file and attach it to a message here. I should be able to tell the nature of the corruption from that. PLEASE DO THIS CAREFULLY OR MY DIAGNOSIS WILL BE WRONG.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby PetrHekr » 25. Mar 2014, 09:29

Hi mpack, thanks for your help.

I can say Yes only to question no. 3. It has been working before and suddenly has stopped.

I followed your instructions and used frHed to get first 10k bytes. Hope it contains what you need. Thanks.
Attachments
my_vdi_first10k.zip
extracted 10k bytes of vdi
(2.48 KiB) Downloaded 56 times
PetrHekr
 
Posts: 9
Joined: 23. Mar 2014, 01:14

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 25. Mar 2014, 13:11

Thanks for that. I've had a look and the bad news is that the header is badly corrupted in some inconsistent way that I don't recognize.

NOTE1: run a disk check on your host hard disk. It may even be advisable to run a slow surface scan overnight.
NOTE2: make a backup of your damaged VDI before you do anything else.

A VDI actually has two headers: a pre header of 72 bytes, then a variable size main header. In your case the preheader is fine (very unusual), but the main header contains garbage after the first few bytes.

OTOH, your block map (what I can see of it within the first 10k) looks intact, so in principle it may be possible to recover this drive if you repaired the header. One way to do that would be to create another VDI with an identical logical size. Then you would use frHed to copy the first 4096 bytes from the new VDI to your damaged VDI, thus replacing the header. Finally you would need to patch the 4 byte "nBlocksAllocated" field at offset 388 (0x184) to match the count of 1MB blocks allocated in the image, which should be roughly equal to the current VDI file size (not the logical capacity), divided by 1MB (1048576), rounding down. Note that the four bytes are least-significant first. You would then attempt to clone the disk to get a fully repaired clone.

You didn't (explicitly) answer an important question: do you have any kind of backup of this VDI file? I would also add: is the data important?

Also, I can give you a better estimate of the correct value for "nBlocksAllocated" if I knew the exact logical size (capacity) of the disk, and the current file size.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby PetrHekr » 28. Mar 2014, 12:05

mpack: thanks for all the information! I'm going to try to fix it. I have no backup and data are important.

Properties in windows says that Size (and also Size on disc) is exactly 37,581,111,296 bytes

What do you mean Capacity? Should be around 35GB as configured upon creation of virtual machine.

Do you need some more information?
PetrHekr
 
Posts: 9
Joined: 23. Mar 2014, 01:14

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby loukingjr » 28. Mar 2014, 12:29

I don't know if it would help but you might ask mpack if boot-repair-cd might help you. It did fix a couple of my .vdi's that would no longer boot.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
 
Posts: 8827
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 28. Mar 2014, 13:36

No, the immediate problem here is with the VDI header, not the guest boot sectors. There may come a time when the VDI header is repaired, at which time we'll see if any damage was done to the guest and this type of repair kit might be needed.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby loukingjr » 28. Mar 2014, 14:07

okay thanks. It's very rare a .vdi becomes corrupted in my experience. in the five years, and hundreds of guests I've installed only two ever went bad and that was because my power went out while the guest was open.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
 
Posts: 8827
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 28. Mar 2014, 15:01

A power outage really shouldn't much affect a VDI header at all. Hard disks are designed to hang on to data when the power is off, so you generally only expect to lose any data that wasn't already written. So the block map could potentially get damaged if the VDI was growing strongly at the time, but the main header was done with when the VDI was created, so you shouldn't be able to lose anything there.

No, this kind of damage requires something else: bad sectors, tampering, background defrag interrupted etc. In some of these scenarios you expect to lose an entire cluster, so in this case it's odd that the preheader is ok - unless the OP repaired the preheader and failed to mention it.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby loukingjr » 28. Mar 2014, 15:07

I just assumed it was because of the power going out because it's the only time I've had a .vdi fail to boot. and it's only happened twice. I suppose it could be a coincidence.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
loukingjr
Volunteer
 
Posts: 8827
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Error VERR_VD_VDI_INVALID_HEADER

Postby mpack » 28. Mar 2014, 16:16

I'm not saying you're wrong about your case, I'm just saying that a power cut, in general, shouldn't corrupt a VDI header.
mpack
Site Moderator
 
Posts: 34516
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Next

Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 23 guests