clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Discussions related to using VirtualBox on Windows hosts.
Post Reply
windstory
Posts: 49
Joined: 16. Nov 2008, 15:55

clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by windstory »

I've an error when making clonehd with "VBoxManage.exe" with vhdx file at windows 10 pro x64.
C:\Windows\System32>cd c:\Program Files\virtual\VirtualBox\

c:\Program Files\virtual\VirtualBox>VBoxManage.exe clonehd --format VDI v:\Hyper
Bankw7\HyperBank.vhdx v:\HyperBankw7\HyperBank.vdi
VBoxManage.exe: error: Could not open the medium 'v:\HyperBankw7\HyperBank.vhdx'
.
VBoxManage.exe: error: VHDX: Can not load the image because both headers are cor
rupt (VERR_VD_GEN_INVALID_HEADER).
VBoxManage.exe: error: VD: error VERR_VD_GEN_INVALID_HEADER opening image file '
v:\HyperBankw7\HyperBank.vhdx' (VERR_VD_GEN_INVALID_HEADER)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MediumWrap,
interface IMedium, callee IUnknown
VBoxManage.exe: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDe
vType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 177 of
file VBoxManageDisk.cpp
And I could not attach this vhdx file to storage for this error message.
Could not open the medium 'V:\HyperBankw7\HyperBank.vhdx'.
VD: error VERR_NOT_SUPPORTED opening image file 'V:\HyperBankw7\HyperBank.vhdx' (VERR_NOT_SUPPORTED).


결과 코드:
E_FAIL (0x80004005)
구성 요소:
MediumWrap
인터페이스:
IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}
호출자:
IVirtualBox {0169423f-46b4-cde9-91af-1e9d5b6cd945}
호출자 RC:
VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
But I loaded this vhdx file at explorer to a drive letter n: successfully.

Please let me know how to attach this vhdx file or clonhd.
Thanks in advance.
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: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by mpack »

vhdx format is not currently supported. If you want to use the disk in VirtualBox you must convert it to a supported format first.
windstory
Posts: 49
Joined: 16. Nov 2008, 15:55

Re: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by windstory »

mpack/

As you can see, I already write the error message about "VBoxManage.exe clonehd --format VDI v:\Hyper
Bankw7\HyperBank.vhdx v:\HyperBankw7\HyperBank.vdi"
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: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by mpack »

Uh... I assume that by referring me to the error message you are saying that you already tried to convert the format?

This ought to be obvious, but you can't use VirtualBox (e.g. VBoxManage is part of VirtualBox) to convert a format which VirtualBox does not understand. That is what the VERR_NOT_SUPPORTED error message is telling you.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by scottgus1 »

Windstory, you'll need to convert the vhdx to a vhd first, outside of Virtualbox. Virtualbox's commands do not yet know how to do anything with a vhdx. Once the vhdx is turned into a vhd, then Virtualbox will be able to convert the vhd to a vdi (which is a good idea, btw, vhd has a design flaw that renders it easy to damage beyond repair). Google "convert vhdx to vhd" for ideas. First link I got has a built-in Microsoft way to do the conversion.
windstory
Posts: 49
Joined: 16. Nov 2008, 15:55

Re: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by windstory »

scottgus1/

Thanks a lot.

I installed Hyper-V function, then convert vhdx image with "convert-vhd" command.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by scottgus1 »

Good, glad you got it converted. Go ahead now and convert the vhd to a vdi in Virtualbox.

The design flaw of vhd is, as I've heard here (from Mpack, if I remember properly), that there's both a header and a footer on the disk data. Some of the info telling the hypervisor (hyper-v, Virtualbox, VMware, any vhd-compatible virtualizer) how to work with the vhd is in the beginning of the vhd file (the header) and some is at the end of the file (the footer). The footer data is the problem. When a vhd is dynamic, that is, when it starts off small and gets bigger as more data gets put into it, that footer has to be moved to a different location on the physical disk. If anything goes wrong while the footer is being moved, then the vhd is kaputz and the data within can't be properly accessed, even if the data is complete. Other disk formats like vdi have only a header, which doesn't move when more data is recorded. So a failure when extending the vdi will still leave the existing data usable. (Or something like that... :) )
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: clonehd --format VDI SOURCE.vhdx DEST.vdi has an error

Post by mpack »

scottgus1 wrote: The design flaw of vhd is, as I've heard here (from Mpack, if I remember properly) ...
Yes, that's pretty much it. Of course the thing that makes this bug particularly important is that encountering the most catastrophic form is easy: if you simply run out of disk space while the VHD is growing, then it can't put the footer back. Of course there are things the implementing code could do to counter this, but still it is bad design.
Post Reply