Error: VDI: invalid pre-header in

Discussions related to using VirtualBox on Linux hosts.
Post Reply
tom-linux-mint
Posts: 12
Joined: 13. Jan 2020, 20:23

Error: VDI: invalid pre-header in

Post by tom-linux-mint »

I am using Linux Mint 19.3, and VirtualBox version 6.0.14 r133895 (Qt5.9.5).

The Guest OS is Windows 10. I have been using this .vdi file for about 4 months. I only know enough about Virtualbox to be dangerous. I have been saving the state of my VM each time I shut it down.
Two days ago, I rebooted the computer while the VM was open. Now, I get this error when trying to start the VM:
------------------------------------------------------------------------
Failed to open a session for the virtual machine TomPC-VM.
Could not open the medium '/home/tom/mnt/MyBulkdata/backups/VM/TomPC/{66d6a110-f882-4d52-9f2f-49ad6300514d}.vdi'.
VDI: invalid pre-header in '/home/tom/mnt/MyBulkdata/backups/VM/TomPC/{66d6a110-f882-4d52-9f2f-49ad6300514d}.vdi' (VERR_VD_VDI_INVALID_HEADER).
VD: error VERR_VD_VDI_INVALID_HEADER opening image file '/home/tom/mnt/MyBulkdata/backups/VM/TomPC/{66d6a110-f882-4d52-9f2f-49ad6300514d}.vdi' (VERR_VD_VDI_INVALID_HEADER).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MediumWrap
Interface: IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}

------------------------------------------------------------------------

I have read that the pre-header can be modified. I have no idea how to do that on a Linux Host.
I see where mpack has helped others by asking them to send the first part of the file. I have no idea how that might be done on Linux OS.
Can someone help me with this issue?
Thanks.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Error: VDI: invalid pre-header in

Post by mpack »

That's a snapshot, not a plain VDI. Sorry, neither CloneVDI nor I can repair corrupted snapshots. They don't lend themselves to repair.

I'm slightly confused by the fact that you seem to be referencing backup folders. Backups should be on secondary drives, preferably offline. I just hope you didn't confuse snapshots with backups, because in that case I think you're about to discover the difference (so to speak).

If it is just a corrupted pre-header then you can try repairing it manually: use a hex editor to replace the first 72 bytes with the first 72 bytes taken from a known-good VDI.
tom-linux-mint
Posts: 12
Joined: 13. Jan 2020, 20:23

Re: Error: VDI: invalid pre-header in

Post by tom-linux-mint »

Thank you for the response mpack. I had taken a snapshot after installing SQLServer just in case I needed to roll back. It turns out that I didn't but I wasn't sure how to remove that snapshot, so I just left it that way and ran the machine from a saved state.
My backups are on a separate machine, and it is just the names I gave the folders.
I have now deleted all of the vdi files that were causing errors.
I added a vdi from a backup copy that I had made back in October and it seems to be working fine.

I really appreciate this forum and your response.
Post Reply