Muffinresearch Labs by Stuart Colville

VirtualBox: Error: Cannot register the hard disk | Comments (33)

Posted in Code, Linux/Unix on 23rd July 2009, 10:27 am by Stuart

If when cloning VirtualBox VMs you get an error like this:

$ VBoxManage clonehd WinXP-IE7.vdi WinXP-IE8.vdi
VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

ERROR: Cannot register the hard disk '/home/scol/.VirtualBox/VDI/WinXP-IE7.vdi' with UUID {3858b1b1-c306-4505-8264-235af812f337} because a hard disk '/home/scol/.VirtualBox/VDI/WinXP-IE7.vdi' with UUID {3858b1b1-c306-4505-8264-235af812f337} already exists in the media registry ('/home/scol/.VirtualBox/VirtualBox.xml')
Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, srcDisk.asOutParam())" at line 603 of file VBoxManageDisk.cpp

Talk about a completely ambiguous error message! The solution is to provide an absolute path to the source VDI and target VDIs (leaving the path off the target will put the image in ~/.VirtualBox/HardDisks by default):

$ VBoxManage clonehd $(pwd)/WinXP-IE7.vdi $(pwd)/WinXP-IE8.vdi
VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: b7166421-9743-4808-aedf-3c90aeb7c902

Post Tools

Comments: Add yours

1. On July 24th, 2009 at 9:26 am Rajat Pandit said:

perfect timing, was about to make clones of the clean xp install to setup the browser lab.

2. On August 27th, 2009 at 5:15 pm MikeG said:

This worked for me:
$ VBoxManage clonevdi `pwd`/SDisk.vdi `pwd`/DDisk.vdi

assuming you are in the directory for both the source and dest. disk :)

3. On August 28th, 2009 at 8:26 am Stuart Colville said:

@MikeG: Yep that works as $(pwd) and `pwd` are equivalent.

4. On September 21st, 2009 at 8:21 am Gabriele Violino said:

thank you!!!

5. On October 14th, 2009 at 3:29 am Mark said:

Thanks for the great information!

6. On October 28th, 2009 at 12:29 pm Sibi said:

Thx for that! I’ve been struggling for several hours now…

7. On November 13th, 2009 at 1:51 pm Mircsicz said:

This shoukd be part of the VBox UserManual.pdf … Have spent half an hour on google to find your very helpful tip!

8. On November 15th, 2009 at 9:12 pm CPP said:

Great help – you made my day!!
I had no idea what that stupid error meant. Gave me hours of headache :-)

9. On November 22nd, 2009 at 8:51 pm N6LG said:

Thank you for saving me a a lot of time.

N6LG – San Francisco, Ca

10. On November 25th, 2009 at 10:02 am Tuzemec said:

Thanx man… saved me a lot of swearings ;-)

11. On December 7th, 2009 at 1:54 pm shinki said:

Thanks a lot for this!

12. On December 19th, 2009 at 7:10 am pete said:

Thanks so much for pointing out that we needed the full path of the source file. Very obscure error message that one.

Hate to think how long it would have taken me to figure that one myself.

Cheers

13. On January 14th, 2010 at 12:55 pm Hay said:

Thanks! What a stupid error message, i wouldn’t have figured out i needed absolute paths without finding this article!

14. On February 3rd, 2010 at 6:25 am Trent said:

Just tried your solution, and the same error occured.

I ran: VBoxManage internalcommands sethduuid Windows.vdi

and that seemed to do the trick ;)

15. On February 10th, 2010 at 2:43 pm James said:

The above recommendations did not work for me in a windows environment, but fortunitely Trent’s recommendation did

VBoxManage internalcommands sethduuid MYBox.vdi

where MYBox.vdi is the name of the virtual HD I copied.

16. On February 11th, 2010 at 3:25 pm AK said:

Thanks a lot, this was a real timesaver!

17. On April 19th, 2010 at 1:30 am Sridhar Sarnobat said:

Thank you!!!!!!!!!!!!!!!!!!!!!! I had the same problem and it was because I was cd’ing to the dir and just providing the relative paths to the source and destination vdi files. It works now.

18. On April 22nd, 2010 at 10:58 am Zeb said:

Thanks dude… that fixed the issue for me.

19. On June 11th, 2010 at 12:11 pm kraklakvakve said:

Thanks a lot, how did you find this out?

20. On June 29th, 2010 at 4:01 pm Chandra said:

Thank you so much for the solution….it saved me time.

21. On July 28th, 2010 at 1:59 am otto_xd said:

Hello.

After several attempts, nothing worked for me.

The issue in my case was the spaces in the paths, when i remove them, it works!

Thank you very much and sorry for my horrible English xD

22. On October 25th, 2010 at 2:44 pm Elanor said:

Thank you I had no idea what was going wrong.

23. On October 26th, 2010 at 3:11 pm Rico Chen said:

Thanks this has saved me a lot of time googling for a fix.

24. On November 4th, 2010 at 6:32 pm Quentin said:

Just another vote of thanks!

25. On November 14th, 2010 at 6:18 am max said:

Thank you a lot !
Save me a lot of time …

26. On November 23rd, 2010 at 9:00 am my 2cents said:

I experienced the problem because the folder where the ISO file was kept (which virtual box read from) was in read-only mode.

After i unchecked read only … worked like a charm :)

27. On December 8th, 2010 at 9:21 pm juandedios said:

if you have the character space in the path use character ‘

example:

VBoxManage clonevdi ‘/media/MASDATOS/Maquinas Virtuales/virtualBOX/WindowsXP2/DiscoWinxp2.vdi’ ‘/media/MASDATOS/Maquinas Virtuales/virtualBOX/WindowsXP2/DiscoWinxp3.vdi’

thanks a lot.

28. On December 8th, 2010 at 10:03 pm Callum said:

Many thanks I have been hidiously stuck with that for a while now…

29. On December 31st, 2010 at 10:54 am 2d said:

Great!

30. On April 20th, 2011 at 11:46 am kszys said:

This is not entirely correct. What needs to be provided is the same path that already exists in the configuration file. Usually it is the full path, but not necessarily… Just check what is there and use the same (changing your current folder if necessary).

31. On May 12th, 2011 at 1:11 am jad said:

thank you very much!

32. On June 27th, 2011 at 7:43 pm Morganizer said:

Thanks so much! I was completely stumped.

33. On December 1st, 2011 at 1:01 pm Alex said:

Thank you!







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(2)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.463s.