Muffinresearch Labs by Stuart Colville

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

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

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

  • http://blog.rajatpandit.com Rajat Pandit

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

  • MikeG

    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 :)

  • http://muffinresearch.co.uk Stuart Colville

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

  • Gabriele Violino

    thank you!!!

  • Mark

    Thanks for the great information!

  • Sibi

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

  • Mircsicz

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

  • CPP

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

  • N6LG

    Thank you for saving me a a lot of time.

    N6LG – San Francisco, Ca

  • http://tuzemec.com Tuzemec

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

  • shinki

    Thanks a lot for this!

  • pete

    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

  • http://www.haykranen.nl/en/ Hay

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

  • Trent

    Just tried your solution, and the same error occured.

    I ran: VBoxManage internalcommands sethduuid Windows.vdi

    and that seemed to do the trick ;)

  • James

    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.

  • AK

    Thanks a lot, this was a real timesaver!

  • http://www.rohidekar.com Sridhar Sarnobat

    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.

  • http://blog.zebsadiq.com Zeb

    Thanks dude… that fixed the issue for me.

  • kraklakvakve

    Thanks a lot, how did you find this out?

  • Chandra

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

  • otto_xd

    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

  • Elanor

    Thank you I had no idea what was going wrong.

  • http://ricochen.wordpress.com Rico Chen

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

  • http://statusq.org Quentin

    Just another vote of thanks!

  • max

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

  • my 2cents

    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 :)

  • juandedios

    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.

  • Callum

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

  • 2d

    Great!

  • kszys

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

  • jad

    thank you very much!

  • http://morganizeit.com Morganizer

    Thanks so much! I was completely stumped.

  • Alex

    Thank you!

Insert a tab character in vim when expand tabs is on|(0)

I have vim set-up to use spaces in place of tabs. Sometimes you need to use an actual tab e.g. editing a Makefile. Now whilst it’s possible to change settings so that tabs are used for specific files, a quick tip to remember is to simply type in insert mode:

Ctrl+v tab

That is Ctrl and “V” and hit the tab key, et voila you’ve entered an actual tab.

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

Photos on Flickr

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