Page 1 of 1
Using a copied VHD file
Posted: 10. Nov 2008, 15:27
by augur
Hi.
I want add another VHD Hard Disk - a copy from a alredy added one - and gets an error. Virtual Box said:
A hard disk with UUID { 34553...} or with the same properties ('D:...') is already registered.
The problem should not be the properties, because the file to add is a new one. So, how can I change the UUID of an VHD file?
Best regards,
Nils
Re: Using a copied VHD file
Posted: 10. Nov 2008, 15:55
by mpack
augur wrote:So, how can I change the UUID of an VHD file?
Go to the command prompt, change to the VBox program files folder (the on which contains VBoxManage.exe), then type :-
vboxmanage internalcommands setvdiuuid filename
Where
filename should be substituted with the full path and name of vdi file.
Posted: 10. Nov 2008, 22:21
by augur
Hi.
Is it possible, that this only works with VDI imaes and not VHD (Microsoft Virtual PC Image)? I get an error like below. But I do not want to convert my VHD image to reuse it on other systems.
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
Error while setting a new UUID: VERR_VDI_INVALID_SIGNATURE (-3201)
thx, Nils
Posted: 10. Nov 2008, 22:43
by mpack
Oops! Sorry, I didn't notice that you said VHD rather than VDI. Since I only briefly played with Virtual PC I don't know how to modify the UUID in a VHD header.
Posted: 11. Nov 2008, 10:51
by augur
Hi.
No problem. But by the way, do you know how to convert a VHD into an VDI image? I only find something to convert a physical hard disk and the documentation is very silent around VHD files.
thx, Nils
Posted: 11. Nov 2008, 16:18
by mpack
augur wrote:do you know how to convert a VHD into an VDI image?
I'm afraid I know of no easy way. Here's a previous discussion about the subject:
http://forums.virtualbox.org/viewtopic.php?t=4511
But if I were you, I'd be checking whether there's a tool to change UUIDs in VHD files. As a last resort I would consider using a hex editor to patch the VHD manually (I like frhed - see
http://www.kibria.de/frhed.html).
Start by making a backup copy of the VHD (I guess you already have that in the original copy).
A VHD actually has both a header and footer (lousy MS design strikes again). In other words the first 512 bytes and the last 512 bytes of the VHD file are two copies of the same "header". Both need to be patched with the same new value. The UUID is a 16 byte value starting at offset 0x44 (68decimal) in the header. Changing any of the 16 bytes should give you a different UUID.
Warning (1): the VHD will of course be huge, so use frhed's "Open partially..." feature.
Warning (2): I haven't personally tried doing this, but I think it should work.
Posted: 11. Nov 2008, 16:31
by mpack
Bummer. I just noticed that there's a 4 byte checksum in the VHD header, immediately before the UUID. The checksum is a straightforward sum of all the non-zero bytes in the header, then the checksum is ones-complemented.
In other words, if you simply add one to any byte in the UUID then you should subtract one from the checksum byte at offset 0x43 (I'm hoping this byte is not already zero - odds of that are 255:1 against).
I'm assuming you can cope with hex. Ask if you aren't sure what to do.
Posted: 11. Nov 2008, 22:19
by Sasquatch
VMWare has a tool to convert VHD to VMDK images. You can then convert the VMDK to VDI image. Or you create a new VDI file, mount that to the existing VM and clone the whole install to the VDI file from the VHD image.