Page 1 of 1

Using VBoxManage clonehd

Posted: 10. Sep 2010, 01:06
by Paul Abrahams
I'm trying to create a copy of a VDI using VBoxManage clonehd, but I get this error:
ERROR: Cannot register the hard disk '/aux/Virtual Drives/Windows XP Ultimate.vdi' with UUID {f7d38364-8b13-4b33-a804-214066c6b9b7} because a hard disk '/aux/Virtual Drives/Windows XP Ultimate.vdi' with UUID {f7d38364-8b13-4b33-a804-214066c6b9b7} already exists in the media registry ('/home/pwa/.VirtualBox/VirtualBox.xml')
D
I've read Section 5.6 of the manual several times, but I still don't understand what the trick is to create the copy I want. I would have expected clonehd to generate a new UUID for the cloned image, but apparently it doesn't. I would like to have the new image behave more or less like a code branch.

Re: Using VBoxManage clonehd

Posted: 10. Sep 2010, 01:43
by Perryg
post the command you are using Paul. This should work if the syntax is correct.
I also need to know what version of VirtualBox you are using.

Command and version

Posted: 10. Sep 2010, 05:05
by Paul Abrahams
The command I used (under Kubuntu Linux) was VBoxManage clonehd "Windows XP Ultimate.vdi" WXPU2.vdi
. The version of VirtualBox is 3.2.8 r64453.

Re: Using VBoxManage clonehd

Posted: 10. Sep 2010, 15:03
by Perryg
Strange. I just tested this command in Windows and Ubuntu to see (I don't use clonehd that much, I use CloneVDI Tool most of the time).
It worked and created new UUIDs on both and I then registered them in the VBox program opened and tested them. See below.
Is your VirtualBox the PUEL version or the OSE from the distro?

Code: Select all

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Perry>VBoxManage clonehd Ubuntu-NetBook.vdi UB.vdi
Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: a481efbf-e549-41ba-8fd5-0ce5be593
077

Code: Select all

perry@perry-u1004:~$ VBoxManage clonehd PCLinuxOS.vdi PCL.vdi
Oracle VM VirtualBox Command Line Management Interface Version 3.2.8
(C) 2005-2010 Oracle Corporation
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: eb513e5c-2ac9-4114-8baa-dfc576ee0180

How is the new UUID generated?

Posted: 10. Sep 2010, 15:36
by Paul Abrahams
I'm wondering how the UUID of the clone is supposed to be generated. The syntax of clonehd is puzzling: it is unclear just how the form with <uuid> works. I believe I'm using the PUEL version of VirtualBox, since as I remember I installed it using files downloaded from the website. But is there any way to verify whether my running version is OSE or PUEL? Help/About doesn't seem to reveal that.

An incidental question: is it possible to clone a running VDI? Or, if not, a paused VDI?

I wonder too if the fact that the clonee's name and directory has spaces in it is relevant.

If it helps, here is the relevant part of the xml file:

Code: Select all

      <HardDisks>
        <HardDisk uuid="{d9e11e9a-af17-4bf6-afed-032767e61bb7}" location="/aux/Virtual Drives/Utility.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{f7d38364-8b13-4b33-a804-214066c6b9b7}" location="/aux/Virtual Drives/Windows XP Ultimate.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{f0fdb44f-b540-45b8-af55-528634d01e10}" location="/aux/Virtual Drives/OpenSuSE.vdi" format="VDI" type="Normal"/>
      </HardDisks>

Output file wrong

Posted: 10. Sep 2010, 15:57
by Paul Abrahams
I tried the same thing on a different machine running OpenSuSE and got the same result.

But I just noticed one thing from the error message I originally got: the VDI that clonehd is trying to create has the same name as the original. In other words, the second argument to the command (the output file) is being ignored and replaced by a copy of the first argument.

Re: Using VBoxManage clonehd

Posted: 10. Sep 2010, 16:14
by Perryg
An incidental question: is it possible to clone a running VDI? Or, if not, a paused VDI?
I don't think so. You would need to rsync or something else if it is still running.
But I just noticed one thing from the error message I originally got: the VDI that clonehd is trying to create has the same name as the original. In other words, the second argument to the command (the output file) is being ignored and replaced by a copy of the first argument.
The only time I have seen this is when the name has spaces or characters and no "" around them.

I see different is you save your files outside of your user space, unless you log in as aux, but that should not cause this issue I don't think.

Explained but not solved

Posted: 10. Sep 2010, 18:15
by Paul Abrahams
After trying a lot of experiments, I have an explanation but not a solution. It appears that clonehd works only if the source image is located in the default directory -- as it was in the case you tried. So how, then, can I clone an image that is not in the default directory (in my case, /home/pwa/.VirtualBox/HardDisks)?

Re: Using VBoxManage clonehd

Posted: 10. Sep 2010, 18:19
by Perryg
I would think by using the absolute path instead of just the name.vdi
Both the source and the end absolute paths would be required.

Problem solved -- sort of

Posted: 10. Sep 2010, 18:51
by Paul Abrahams
I now understand better what's going on and what to do about it, but still, all is not well. If you specify the source with an absolute pathname, the command works as expected. If you specify the source as a simple filename and that filename exists in the default directory for VDI's (~/.VirtualBox/HardDisks), it also works as expected, using the VDI in the default directory. But if you specify the source as a simple filename and it doesn't exist in the default directory, you get the weird behavior that I encountered. That does seem to be a bug.

Re: Using VBoxManage clonehd

Posted: 10. Sep 2010, 18:53
by Perryg
You can report it here if you like bugtracker. You will need to setup an account there as it is on a different system.
It would also help if you can post the ticket number here so other can see the progress, add information, or see the final results.

Re: Problem solved -- sort of

Posted: 10. Sep 2010, 22:19
by mpack
Paul Abrahams wrote:That does seem to be a bug.
I agree. At the very least the bug is a misleading error message. Thanks for pinning this down. As Perry suggests, I hope you'll take time to file a formal bug report.

Bug report at bugtracker

Posted: 11. Sep 2010, 02:29
by Paul Abrahams
See ticket #7458.

I still don't understand what works and what doesn't with the filenames. And the form with just a uuid is a real mystery. Clearer doocumentation is needed.