Invalid header in snapshot - attempting hex editor fix

Discussions related to using VirtualBox on Windows hosts.
Post Reply
TimOz
Posts: 6
Joined: 17. Jun 2022, 19:48

Invalid header in snapshot - attempting hex editor fix

Post by TimOz »

I moved a VM using the proper method (Virtualbox > right-click > move) but now one of my snapshots has an invalid header msg:

See attachment 1

Some people have fixed similar problems by changing the header using a hex editor. See third last post here:
viewtopic.php?t=69736

But my attempts so far have failed.
Any advice?
Is the snapshot too corrupted to fix?

Att 2: The bad snapshot
Att 3: A good snapshot from earlier
Fixed snapshot: The edited version of the bad snapshot after I replaced down to line 170 (inclusive) with the lines from the good snapshot:

https://pasteboard.co/muGYwYmA6nzf.jpg

(Had to use an external site, since this forum only allows 3 attachments of 128kb each)
Attachments
Att 3: Good snapshot
Att 3: Good snapshot
Good snapshot.jpg (102.9 KiB) Viewed 923 times
Att 2: Bad snapshot
Att 2: Bad snapshot
Bad snapshot.jpg (108.04 KiB) Viewed 923 times
Error msg.jpg
Error msg.jpg (49.92 KiB) Viewed 923 times
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Invalid header in snapshot - attempting hex editor fix

Post by mpack »

All of the cases of hex editor repair you will have seen will have been to a stand alone VDI. Repairing a snapshot using that method is practically impossible, unless the damage is of the trivial "pre header only" variety. Note in particular that inappropriately "repairing" a snapshot by comparing with a stand alone VDI could potentially cause even greater damage, propagating corruption to other elements of the chain.

The only cure I know of for a corrupted snapshot is a backup. Failing that you can only recover data from elements of the chain up to but not including the damaged snapshot VDI.

The fact that snapshots are difficult or impossible to repair is one of many reasons why experienced users avoid them.
TimOz
Posts: 6
Joined: 17. Jun 2022, 19:48

Re: Invalid header in snapshot - attempting hex editor fix

Post by TimOz »

Thanks alot, that's useful.

Two Q:

1. How do I recover the data? I tried 'restore' snapshot from snapshots made BEFORE the error and it still came up with the same error (invalid header on that one snap)
One thing I don't really want to go through again is adding my 11 hard drives!

2. My reason for using snaps was to be able to try things out on the virtual machine but then be able to revert to my previous OS, a bit like disk imaging software. Is there a way to achieve this without snaps?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Invalid header in snapshot - attempting hex editor fix

Post by mpack »

Are you sure that the corrupted VDI is the one you think it is?

And as I said above, the only cure I know of for a corrupted snapshot is a backup. You can't access data in a snapshot, the are not stand alone file cabinets. A snapshot is a chain, effectively a patch chain, you need a complete chain before any data can be recovered - another reason why no experienced person relies on them, certainly not without making backups.
TimOz wrote: My reason for using snaps was to be able to try things out on the virtual machine but then be able to revert to my previous OS, a bit like disk imaging software. Is there a way to achieve this without snaps?
Just make a backup of the VM folder to secondary storage, then you can recover from anything, including malware or a failed hard disk or PC.

Try cloning the snapshot using CloneVDI. View the readme for how. At the very least you can determine which is the longest uncorrupted chain you can make.
Post Reply