Using a copied VHD file

Discussions related to using VirtualBox on Windows hosts.
Post Reply
augur
Posts: 4
Joined: 10. Nov 2008, 15:21

Using a copied VHD file

Post 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
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: Using a copied VHD file

Post 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.
augur
Posts: 4
Joined: 10. Nov 2008, 15:21

Post 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
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

Post 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.
augur
Posts: 4
Joined: 10. Nov 2008, 15:21

Post 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
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

Post 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.
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

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply