VHD error after mounting it with DiskPart

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Davii
Posts: 2
Joined: 15. Feb 2018, 03:10

VHD error after mounting it with DiskPart

Post by Davii »

So, something's broken and I don't quite know what, or how, or how to fix it. I mounted my vhd file with diskpart. Made a small change. Detached it again. And now the client won't boot. And it won't restore to a snapshot either.

Diskpart commands:

Code: Select all

select vdisk file="c:\disk.vhd"
attach vdisk
detach vdisk
Error:
Parent UUID {00000000-0000-0000-0000-000000000000} of the medium 'C:\Users\laned\VirtualBox VMs\Win7\Snapshots\{07b58676-c5c0-46b8-9389-d041ed16427b}.vhd' does not match UUID {116c03a6-9502-40ad-ba77-7efe1252f264} of its parent medium stored in the media registry ('C:\Users\laned\.VirtualBox\VirtualBox.xml').
E_FAIL (0x80004005)
MediumWrap
IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}
Is this fixable? Any ideas or suggestions? Many thanks in advance!

[Mod edit: Changed the title from "Diskpart" to something more appropriate. Please choose a better suited titled, something that can help future users, and attract more answers to your problem]
Last edited by socratis on 15. Feb 2018, 06:14, edited 1 time in total.
Reason: Changed title to something more appropriate.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VHD error after mounting it with DiskPart

Post by mpack »

Looks like this is a clone, and not the original VHD. It can only be fixed by restoring the original VHD to its original position.

Question: was it the snapshot named in the error message or the base VHD which you mounted in DiskPart? The snapshot wouldn't have mounted unless you cloned it, and the base VHD ought to have had files missing. This would be the danger of (mis)using snapshots without understanding them.
Davii
Posts: 2
Joined: 15. Feb 2018, 03:10

Re: VHD error after mounting it with DiskPart

Post by Davii »

Definitely user wading in with both feet and misusing without understanding! Classic case of EBCAD (Error Between Chair And Desk :oops: )

It was the base vhd that I mounted.

I was going to be moving a lot of files around, so when I created the vm, I stored the vhd on a separate drive. After install, I created a snapshot. I assumed snapshots took a copy of the vhd and the original vhd continued to be the master. After all, it was where I'd told it to create it, and there was no suggestion that I might like to save the snapshot somewhere. Anyway, I saw something that said you could mount vhd's in Windows, so I figured it must be quicker to use the host for extracting data from the vhd, rather than have the vm copy into a shared folder. So I took another snapshot, shut down the client, and mounted with diskpart. The data on the vhd was in user's directory, so I took ownership of the directory... which now of course means the base vhd is changed, which I'm assuming is the problem here. Although, the error is far from clear.

Forgot to say that I've tried mounting the snapshot's vdisk with diskpart, which gives the following:

Code: Select all

DiskPart has encountered an error: The file or directory is corrupted and unreadable.
See the System Event Log for more information.
Can't see that it would have helped, but there's actually nothing in the event log.

I have no backup of the original vhd. Is there a way to recover the snapshot, or the data in the snapshot vhd?
Luckily, I have a backup of the original source files, so if the answer is no, I can at least recreate my work. At which point, I guess I'll find out whether I have to reinstall the vm from scratch. It was only 30 hours' work, another hour or so to install Win7 + updates won't make much difference :lol:
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: VHD error after mounting it with DiskPart

Post by mpack »

Davii wrote:Although, the error is far from clear.
IMHO, you can't really expect VirtualBox to be clear about an error condition that is completely outside its control. It told you everything it knows: you have a mismatched base and snapshot.

And no, if you screw the base image then every dependant snapshot is dead. Lucky you that you didn't have like 50 snapshots hanging from it, which I have seen.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: VHD error after mounting it with DiskPart

Post by socratis »

Davii wrote:I assumed snapshots took a copy of the vhd and the original vhd continued to be the master...
...I figured it must be quicker to use the host for extracting data from the vhd
Wrong assumptions.
Davii wrote:The data on the vhd was in user's directory, so I took ownership of the directory
Wrong move.
Davii wrote:I have no backup of the original vhd.
Wrong strategy.

But you know what your biggest "omission" in this whole adventure was? That you didn't try it first. You didn't create a test VM to see how snapshots behave, how VHDs get mounted, what it all means. And all of that without a backup! Because it was faster:
Davii wrote:It was only 30 hours' work
I bet now that the 2 hours you would have spent testing the above theories/behavior would seem like a better choice... ;)

But fear not. Be saddened not! If it was only 300 hours that I've lost in the course of doing the exact same mistakes as you (and worse), I would be a much happier camper...

Davii wrote: Classic case of EBCAD (Error Between Chair And Desk)
I had never heard of EBCAD, but I have heard of PEBKAC (Problem Exists Between Keyboard And Chair). A quick search lead to the User Error Wikipedia article, which had the following gem:
Related terms such as PEBKAC (Problem Exists Between Keyboard And Chair), ID-10T error (idiot error), PICNIC (Problem In Chair, Not In Computer), IBM error (Idiot Behind Machine error) and other similar phrases...
I really loved the "ID-10T" and the "IBM" ones... :D


@mpack
mpack wrote:Lucky you that you didn't have like 50 snapshots hanging from it
Do you remember the largest amount of snapshots that we've seen? I believe it was in the neighborhood of 125. Or was it 175? Definitely more than 100, about 4 years back. Even the .vbox file was more than 1 MB!!! I need to find that post and have it as an example of what not to do...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply