Change UUID of VirtualBox vdi

Looking for quick way to reuse a vdi I preped with Windows XP SP3 and recent updates, I decided to duplicate the vdi with Windows Explorer. Of course, this was too simple. After attempting to create a new virtual machine which used the newly created vdi, I was presented with a nasty error along the lines of  “Failed to open the hard disk ….” and “Cannot register the hard disk C:\path\to\new\vdi with UUID {xxxx} because a hard disk C:\path\to\old\vdi already exists in the media registry (C:\path to VirtualBox.xml)

VirtualBox UUID Error

Luckily there is a simple fix for this…

Lauch a command prompt and browse to where VBoxManager.exe is located (for me this is C:\Program Files\Oracle\VirtualBox) and run the comand below

VBoxManage.exe internalcommands setvdiuuid "C:\path\to\new\vdi"

NOTE: the command has been changed to sethduuid in version 4.0.4 (thanks Isaac!). So the commad in 4.0.4 would be…

VBoxManage.exe internalcommands sethduuid "C:\path\to\new\vdi"

Which should return something similar to “UUID Changed to …”

Change UUID with VBoxManager

{ 46 comments… add one }

  • Isaac W. March 17, 2011, 8:57 pm

    With version 4.0.4, use “sethduuid” instead of “setvdiuuid.”

    Reply
  • Shaik June 8, 2011, 6:30 am

    Its Working fine.
    Thanks a Lotttttttt

    Reply
  • M.Back June 17, 2011, 10:43 am

    thanks a lot fot that good description!

    Reply
  • Mostafa July 1, 2011, 1:37 am

    Extreme big hug thank u !!!
    the manual really sucks and u give it like a glance :d

    Reply
  • Amyo Rahman July 6, 2011, 3:42 pm

    Thanks!!

    Reply
  • MS July 22, 2011, 2:15 pm

    Thanks for sharing, this helped for sure!

    Reply
  • Dave K August 29, 2011, 4:45 am

    Genius! What a life saver! Many Thanks

    Reply
  • Neeraj Pansari September 29, 2011, 7:17 am

    Thanks for the detailed info.
    It is easy and it works fine :)

    Reply
  • Asadi October 24, 2011, 1:03 am

    Thanks, I used “sethduuid” instead of “setvdiuuid.”

    Reply
  • Sergey November 28, 2011, 10:22 am

    Thanks a lot! It’s helped me on 4.1.6 version, I uses “sethduuid”

    Reply
  • Ricky November 30, 2011, 3:34 am

    It solved my problem, thank you very much.

    Reply
  • Jim December 2, 2011, 12:40 pm

    Worked on a VMDK (VMWare) disk as well (that I’m using under VirtualBox). I pulled many hairs over the last few days until I found your post – thank you.

    Reply
  • liming December 5, 2011, 8:16 am

    thank you ! 终于知道解决方法了……(NOTE: the command has been changed to sethduuid in version 4.0.4 (thanks Isaac!). So the commad in 4.0.4 would be…)

    Reply
  • Richard Hundhausen March 6, 2012, 2:31 pm

    Thanks Randall. You saved me some time today!

    Reply
  • sammi April 24, 2012, 7:30 am

    Thanks alot

    Reply
  • LazerFX April 30, 2012, 11:30 am

    Thanks, you just saved me a load of time :D This blog-post is going in my bookmarks for sure. Like others, I used the new (sethduuid) command format, with VirtualBox 4.1.12 :)

    Reply
  • Adam May 4, 2012, 1:38 pm

    When I try to run sethduuid on 4.1.14 using this command:

    vboxmanage internalcommands setheuuid “E:\vm.vdi”

    I get the following error:

    VERR_FILE_NOT_FOUND at D:\tinderbox\win-4.1\src\VBox\Storage\VD.cpp(4484) in function VDOpen
    VBoxManage.exe : error: Cannot open the image : VERR_FILE_NOT_FOUND

    I have no D: drive and have nothing to do with tinderbox. Help!

    Reply
    • R. Kent May 7, 2012, 2:03 pm

      Adam -

      Can you confirm your .virtualbox file is pointing to the correct location of the vdi?

      Reply
      • Adam May 7, 2012, 2:33 pm

        Yes, and no reference anywhere to a D: drive.

        Reply
        • Adam May 7, 2012, 3:43 pm

          SOLVED – turns out vboxmanage is case sensitive when looking at path and file names.

          Simple solution!

          Reply
  • hamid May 10, 2012, 8:50 am

    thanks a lot !
    Good answer

    Reply
  • Arnold June 5, 2012, 5:33 am

    Its works great ! Thx

    Reply
  • Thodoris June 25, 2012, 2:22 pm

    thank you…. It was just driving me crazy :)

    Reply
  • Jason September 1, 2012, 1:10 am

    Thanks a lot!
    That’s so easy

    Reply
  • Alex November 2, 2012, 6:01 pm

    Thanks a lot! Resetting the uuid via cmd totally fixed my problem. You’re the man!!

    Reply
  • Jun November 24, 2012, 1:39 pm

    Thanks a lot ! My problem was solved!

    Reply
  • Taher December 13, 2012, 11:39 am

    Thx a mil

    Reply
  • Rahul December 27, 2012, 1:37 am

    Thanks a lot!
    It was really useful for me to save my time….

    Reply
  • Tamil Astrology January 16, 2013, 9:41 am

    Thank you very much. I knew there was a solution and it was in the back of my mind. Your link was the first entry when I searched for the solution.

    I had copied a cloned image into a different location (instead of the default C: drive), which, when I tried to use, caused this error.

    Reply
  • Vito April 3, 2013, 9:45 am

    I have use the command and I do not have any error but when i try to import the Virtual Machine Definiton file I obtain the same error. There is another way to solve the problem? Thanks.

    Reply
    • R. Kent June 18, 2013, 4:26 pm

      Vito –

      Check out @thegeekprophet’s reply with the reminder to update the UUID in the .vbox file. Let us know if that works!

      Reply
  • thegeekprophet April 10, 2013, 10:32 am

    If it still complains, dont forget to update the UUID in the .vbox file for the drives you updated…

    Reply
  • Alex June 24, 2013, 11:57 pm

    Thanks for posting this, worked perfectly for me! I needed to transfer a VBOX hard drive image to a different drive to save space which ought to be a common/easy function in VirtualBox, but isn’t. I copied the file and then changed the UUID with the command you posted. If you’re in Linux (Ubuntu, in my case), this is the command you’ll want to use:

    vboxmanage internalcommands sethduuid pathto.vdi

    Reply
    • odeklas November 7, 2013, 11:01 am

      Thanks a lot , saves me a headache ;)

      Reply
  • sgk August 5, 2013, 3:21 am

    Thanks man.. it worked perfectly..!!

    Reply
  • Mahdi August 19, 2013, 1:46 am

    Thanks Thousands

    Reply
  • j September 27, 2013, 12:50 am

    for version 4.2.18 what should i use instead of setvdiuuid and sethduuid

    Reply
  • Nick October 11, 2013, 9:04 am

    Thanks.! It worked with “VirtualBox 4.2.18″

    Reply
  • Joakim Olsson October 15, 2013, 4:24 pm

    BIG thanks for easy fix to super frustrating problem.. MAN that was one whiny moron of a hurdle…

    Reply
  • Henry November 8, 2013, 1:01 pm

    Hey I’m trying to use this with a vhd file and I’m getting invalid UUid parameter….does this work with vhd files? I see you guys are using a vdi file…please help
    Henry

    Reply
  • jk December 19, 2013, 1:46 am

    thanks a lot!

    Reply
  • Mario Roberto December 19, 2013, 5:13 pm

    Very useful info. Thanks a lot.

    Reply
  • FreyrLin January 3, 2014, 11:26 pm

    Very thanks, it do helpful !
    Solved my same problem on virualbox : )

    Reply
  • Pawblosky January 10, 2014, 11:50 am

    Muchísimas gracias, me ayudó (;

    Reply
  • Pawblosy January 10, 2014, 11:55 am

    Yo tengo la versión 4.3.6 y me sirvió con sethduuid

    Reply
  • Jerry March 8, 2014, 5:03 pm

    Was trying to move a hard drive file and ran into this issue. Thanks for the information. Worked like a charm.

    Reply

Leave a Comment

Next post:

Previous post: