VirtualBox – Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists

Virtualization is awesome! It really helps when you are a developer.  On my laptop I don’t even have SQL Server installed on the OS directly.  In fact the only thing I have installed on my host is Office, Skype and Chrome.  Everything else gets run on a VM.
SSIS package creation using BIDS: VM.
SQL Server Management Studio: VM.
SharePoint sandbox: VM
VPN: VM.

One of the advantages of doing this is you don’t have to worry about screwing something up.  I have a snapshot on the VM just before I installed SQL Server.  So if something happens and my install gets corrupted I will just roll it back and reinstall SQL Server rather than the entire OS plus SQL Server. Currently to do all this I am using Oracle’s VirtualBox software.  It works great for those of us who have Windows 7 and allows you to run both x86 and x64 virtual machines.  I recently tried to make a copy of one of my VHDs (Virtual Hard Drive) and create a new VM.  Everything was wonderful until I got this error:

Failed to open the hard disk <FilePath>.
Cannot register the hard disk <FilePath><GUID> becuase a hard disk <DifferentFilePath> with UUID <GUID> already exists.

I looked all over the place to find what was causing it and finally found a fix. Of course it requires the command prompt, so open that junk up and let’s get started!

**Note that I am on VirtualBox version 4.1.6 and from what I’ve read this command used to be something different a few versions ago. I think instead of setdhuuid it was setvdiuuid, but don’t hold me to that.**

  1. Open the Command Prompt
  2. Change the directory to where VirtualBox is installed (Default: C:Program FilesOracleVirtualBox)
  3. Type the following VBOXMANAGE.EXE internalcommands sethduuid <PathOfNewVHD>

Note that internalcommands and sethduuid need to be lowercase.  I spent more than a couple minutes trying to figure out why things weren’t working.  🙂

Below is the output of me changing the ID of the VHD located at C:UsersbschachtVirtualBox VMsWindows XP (VPN) Copy.vhd

Bradley Schacht

Bradley Schacht is a Data Platform Solution Architect on the state and local government team with Microsoft based in Jacksonville, FL. He has co-authored 3 SQL Server books including "SQL Server 2014 Professional Administration". As a former consultant and trainer, he uses his experience on many parts of the Microsoft BI and data platform to help customers deliver the best possible solutions. Bradley frequently presents at community events around the country. He is a contributor to sites such as SQLServerCentral.com and an active member of the Jacksonville SQL Server User Group (JSSUG).

You may also like...

159 Responses

  1. Naresh says:

    Thanks a bunch Bradley. You made my day!

      • BJ says:

        A very simple batch file and thanks so much for your help!!

        @echo off
        cls
        cd C:Program FilesOracleVirtualBox
        echo 1
        echo 2 Run this from the command prompt and add the full path and file
        echo 3 name of the HD you are trying to RE-register. QUOTES ARE REQUIRED
        echo 4
        echo 5 EXAMPLE: ReRegisterHD.bat “C:VirtualBox VMsVista32Vista32.vdi”
        echo 6
        echo 7 Verify the directory and HD below is what you want re-registered.
        echo 8
        echo 9 %1
        echo 10
        echo 11 Full command that will be executed is:
        echo 12 VBOXMANAGE.EXE internalcommands sethduuid %1
        echo 13
        echo 14
        pause
        @echo on
        VBOXMANAGE.EXE internalcommands sethduuid %1
        @echo off
        cd C:UsersLoginVirtualBox VMs
        ECHO ******************
        echo **** COMPLETED ***
        ECHO ******************

  2. Vikas says:

    Thanks Bradley. Precisely what I was looking for and worked first time.
    Cheers!

  3. Minh says:

    Thanks a lot Bradley!!!

  4. Werner says:

    Thank you very much, it works very fine.
    I tried some things before and I read some hints but nothing has worked.

    thank you!

  5. Grateful says:

    Great save, thanks for sharing.

  6. Kathi says:

    Thanks! That worked!

  7. JCouch says:

    That worked! Thank you very much!

  8. VS says:

    Thank you

  9. Guby says:

    Great Post man !
    You made my day … was planning to reinstall and dunno what more 🙂

    Cheerz Guby

  10. Excellent help. Made handling this problem quick and easy
    Thank you so much for posting this

  11. DS says:

    Thanks! Worked like a charm!

  12. Stefan says:

    Thanks a lot!!!!

  13. Dario says:

    Muchas gracias, muy precisa tu ayuda!

  14. Shrey says:

    Worked like a charm thanks.

    I had to run the command agains my *.vdi image instead of *.vhd

  15. Timo says:

    Thank you! Can confirm that this also works on osx:

    VBoxManage internalcommands sethduuid /PATH/TO/DISK.vdi

  16. Paul says:

    Awesome, just what I was looking for.

  17. Joe says:

    You the man!

  18. Mr. BizTalk says:

    I love simple and quick fixes.
    You the man, Bradley!

  19. Olivier. R says:

    Thanks !

  20. bel3ax says:

    a quick search in Google and there is the solution, thanks!

  21. Thanks! Just the info I needed to make this work 🙂

  22. anonimo says:

    Excelente viejo!!! funciona de lujo!.

  23. Demetrio says:

    Thanks Bradley!!!

  24. Bill says:

    Most helpful!

  25. Francis says:

    Thank’s for this, under linux upper and lower are very important you must use
    VBoxManage internalcommands sethduuid

  26. Wouter says:

    Thanks very much, great help

  27. Gacek says:

    Got a better solution.
    Swap the folder names of the images.

    For example ubuntu and ubuntuNew
    you change into ubuntuOld and ubuntu

  28. Ian says:

    Thanks for this, good of you to share this knowledge gem…

  29. Dave Staab says:

    This is what I needed. Thanks!

  30. Aditya says:

    Thanks a lot.

  31. Hello.
    there is a much simpler solution I found here.

    If you get the error “Cannot register the hard disk … because a hard disk … with UUID … already exists.”

    – In VirtualBox, click on “File->Virtual Media Manager”
    – Select the Vdi and click on “Remove”.

    src: http://www.archibel.com/103.html?&tx_ttnews%5Btt_news%5D=1346&cHash=561ca0343c17b094a004fd2dd6cd207c

  32. lakshmi says:

    thanks. appreciate it very much

  33. Thanks for posting a solution for this annoying problem! Appreciated very much

  34. j04k1m says:

    solve my problem!

    Thanxs!

    yeah, my english is sux, so what?

  35. chrisjacob says:

    Thank you, this worked for me (on Win8)

  36. Sergio says:

    Thank you, it worked on VirtualBox 4.2.6!

  37. Worked for me also, thanks

  38. Kock Hua says:

    It work for me too (using Window 7, VirtualBox 4.2.0). This is a great finding. It is simple and easy.

  39. piss cop says:

    Thanks dude! Never would have figured out what command line bullshit to execute.

  40. muthukumaran K says:

    Hi ,

    I am getting the below error while tryin in command line.. Can any one suggest ??

    VBoxManage.exe: error: VD: error VERR_PATH_NOT_FOUND opening image file ‘c:User
    sbschachtVirtualBox VMsWindows XP copy.vhd’
    VBoxManage.exe: error: Error code VERR_PATH_NOT_FOUND at D:tinderboxwin-4.1sr
    cVBoxStorageVD.cpp(4473) in function VDOpen
    VBoxManage.exe: error: Cannot open the image: VERR_PATH_NOT_FOUND

  41. Nandita says:

    Thanks for the fix!

  42. bitworks says:

    Thanks, this really helped me out. I was stuck in the muddled mess which is the virtualbox forums, this is exactly what I needed

  43. Hank says:

    For the problem with Windows XP copy.vhd
    try quoting the full name of the file you’re trying to change

    so it would be
    c:UsersbschachtVirtualBox VMs”Windows XP copy.vhd”

  44. David says:

    As has been mentioned, this resolved my problem too. Thank you very much. This feels a little bit like a bug, or at the very least something that should/could be handled by the GUI a little more elegantly (or at all). Thanks again for your post.

  45. Ani says:

    thank u very much for this post………………..

  46. Fachex says:

    yo sooo rock!

  47. Zahid says:

    Thanks . May Allah bless you.

  48. Antonio says:

    Thanks! That worked!

  49. Bobby Pejman says:

    Thanks a million! You made my day!

  50. Rakesh Nair says:

    Thank you.. your solution worked for me. I had moved the VirtualBox HD to a new drive and was hanging…

  51. gary says:

    Thanks. This helped immensely.

    You may want to mention that if you get a “VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or failed to start.” error, make sure you’re running the vboxmanage… command from a standard (non-administrator) CMD prompt.

  52. Carlos says:

    Thanks. Great contribution

  53. frank says:

    Brilliant! A full detailed explanation! Worked first time. Not like the instructions left behind by those lazy users on the VirtualBox formum who say things like, run internalcommands sethduuid at the command line…

  54. Nick Jeske says:

    Thanks a lot for this. Really helped me out!

  55. dreamweiver says:

    thanks a lot bradley

  56. mrs hai says:

    Thanks you very much. I resolved this problem.

  57. Jan says:

    Didn’t help, using 4.2.4

  58. Gerrard Shaw says:

    Thanks, brought my XP VM back to life 🙂

  59. Pedro says:

    Many, many thanks.

  60. FA says:

    Thank you 🙂

  61. Shah says:

    Great fix! Had to use solution this quite a few times as I deal with VMs for my environment.
    Many thanks for sharing the talent.
    Shah

  62. Des says:

    Saver. I was about to remove those files that took hours to copied over to an external hdd. Your post definitely save the day. Bravo!.

  63. Diable says:

    My emergency rescue! A really good hint that worked perfectly!
    Many thanks !!

  64. Julian David says:

    It worked. Thanks a lot.

  65. Alexis Lamonja says:

    Thank you, It worked for me too!
    Very usefull

  66. Luís Santos says:

    Thanks. Useful information well presented.

  67. Anonymous says:

    Really cool, thanks for posting this. You saved me hours of searching!

  68. Aija says:

    Thanks a lot.

  69. jrd says:

    Thanks man, works on OS X too! (without exe though 😛 )

  70. David says:

    Thanks a Lot, man!

  71. 1450 says:

    Great, bro! It still works at 4.2.18!

  72. Lakino Zetar Yum says:

    Thanks for sharing ! I have the same problem here with Virtual Box and VHD file

  73. ivc says:

    lovely, thanks.

  74. kpcz says:

    Thanks big time.

  75. Alex says:

    Thanks a lot Bradley ! you saved me
    Now my VirtualBox ver. 4.02 is working !

  76. Hunter says:

    Just what I needed!

    That command does not like VHD files with spaces in;The command failed the first time so I copied the VHD and renamed it without spaces and it work!
    The darn thing needs validating again though 🙁

  77. Justin says:

    Thank you very much for this. I had reinstalled my OS to a new HDD (solidstate) and was using my old drive as a data drive and the change in drive letter was just throwing everything off.

  78. Sean says:

    Worked perfectly for a copied VM, thanks!

  79. Kostadin says:

    Thanks a lot mate, really helped 🙂

  80. Jon Gilbert says:

    On Mac at least you can just edit the YourVM.vbox file in a text editor. It’s just an XML file. The very first property is VirtualBox/Machine/MediaRegistry/HardDisks/HardDisk … quit VirtualBox, then edit this file by changing the location attribute’s value to the path to your VM. Save the .vbox file, close it, then restart VirtualBox and boom, problem solved.

  81. Samuel says:

    Thank you. It works for 4.3.8 version! Cheers!

  82. Ruslan says:

    Thanks a lot )) Really helped

  83. Justin says:

    Thank you! Awesome solution.

  84. Julie says:

    Thanks. Really helped.
    works with version 4.3.10. 🙂

  85. Thank you! while i didn’t use these commands it led me to the media manager where i’m using it to copy a vdi from external hd to internal ssd.

  86. var says:

    This error can occur when trying to handle virtual disks outside of the Virtual Media Manager (File->Virtual Media Manager). The error indicates the disk you are trying to add exists in the list of available virtual disks, virtual disks can be modified/removed/copied through the Virtual Media Manager to avoid this particular issue.

    If you have manually copied the virtual disk to another location, and want to use the new virtual disk, you can enter the Virtual Media Manager and remove the old virtual disk, then proceed to add the new virtual disk through the Settings->Storage window.

  87. Angel says:

    Thanks! It worked for me in Linux:
    $ vboxmanage internalcommands sethduuid /path/to/new/file.vdi

  88. Bob says:

    This worked for me on Windows 7. Thanks so much man! Very helpful guide.

  89. Nick says:

    Thanks this worked perfectly for me and saved me time 🙂

  90. DjElko says:

    Thank you for that!
    I moved the VHD to another HDD and got the error as I wanted to register the VHD in the drive manager 😀

  91. MicroTronics says:

    I had to move a VHD to another machine. Of course it gave this same error. But instead of using the command Prompt I deleted all the logs from the Logs directory… and it worked!
    might be worth a try.

  92. Yondonsuren Namkhainorov says:

    thanks very much

  93. Tomik says:

    Thanks very much, it works!

  94. Karthi says:

    Thanks, it just works

  95. Thanks! It really helped. This issues with copying VMs are really annoying.

  96. p8ndus says:

    Thanks ! Worked when I had ro rename my virtual PC and .vdi file.

  97. Dawid says:

    Works for me as well, thank you!

  98. Kris says:

    Great!! Worked!

  99. Sinan AKAY says:

    Hey Brad Thanks a lot, it worked for me too like all the others here:)
    Let me just add for the next guy coming from a Mac:
    open terminal
    type
    vboxmanage internalcommands sethduuid

    UUID changed to: QSMLDFK922-9912548blkqmsldkjfmlksDF

    and that’s it simple and efficace the way I like it 🙂

  100. Sinan AKAY says:

    vboxmanage internalcommands sethduuid
    for whatever reason was not in the first comment

  101. Sinan AKAY says:

    OK ! “” is not allowed 🙂
    it should read:
    vboxmanage internalcommands sethduuid ‘path’

    something like: vboxmanage internalcommands sethduuid /Volumes/STOREVA-1TB/Otherdisk.vmdk
    UUID changed to: 49qdsf;:gqmsd6-411a-41a1-8922-99sqdFLsdmlfd290

  102. VBoxAddict says:

    Nice one and good to know! Same happened to me when I tried to copy the VDI manually, and found the solution here:

    https://www.it-gems.com/2014/11/fix-vboxmanage-error-register-hard-disk-hard-disk-uuid-already-exists.html

  103. ibrahim says:

    thanks man. Big help .

  104. VM Admin says:

    Bradley, thanks. It works! 🙂

  105. John says:

    Muchas gracias, desde México

  106. Martin says:

    you saved my life!!! I just copied my VM files from one harddrive to anohter bc of low HD capacity and got the same problem. your solution just worked perfectly!! thank you very much! cheers from Switzerland

  107. Matt says:

    It works, but changes the hardware ID of the VM :/

  108. 稚空 says:

    Better way:
    1. File > Virtual Media Manager
    2. Choose the Hard drive that you want to remove
    3. Release
    4. Remove
    Done!

  109. Alex says:

    Thank you!!!

  110. Steve Wilson says:

    Good post. Many thanks.

  111. pramodte says:

    Thanks to sharing the info.

  112. Akira says:

    Works perfect! Thank you!!!

  113. James says:

    Well that made my life much much easier 🙂 (and next time I won’t change my mind about the location of the VM….oh wait, I just got a new 512GB SSD…darn it! 🙂 )

  114. q539 says:

    thank you!

  115. Thales says:

    Works fine. Thank you!

  116. John says:

    Thanks! This helped.

  117. Gordon says:

    Just what I needed, thanks.

  118. Suraj says:

    Worked very well. Thanks a lot.

  119. Frank says:

    Still works! Thanks!

  120. Alex says:

    Thanks a bunch! Got me out of trouble when trying to find an older project on one of the company’s older, retired vms.

  121. shweta says:

    thank you so much …its really nice and worked in one shot.

  122. Hansey says:

    Thanks for making this, probably spared me an hour or two there!

  123. Yvonne says:

    Thanks! 🙂

  124. nnn says:

    Thanks a lot from Düsseldorf

  125. Tim says:

    Thanks ! it really works for me

  126. madho1408 says:

    Many thanks

  127. Ver says:

    Thanks for the article, helped me a lot!

  128. this is really amazing. it works perfectly, thank you for sharing

  129. Guido says:

    Thank you very much!!!!!!!!!!!!!!!

  130. Stefan Krissel says:

    Thank you – it works

  131. Avi says:

    Thanks a lot.
    This post helped me solve my issue quickly without having to waste any time in forums looking for the right answer 🙂

  132. Timmy says:

    This is what I got when I tried to startup the vm
    Failed to open image ‘C:\oelvmdatabase.vdi’ for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY).
    AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY).

    I already give control for the full permission in properties. What can I do ?

  133. Ramon Sanchez says:

    Works Great

  1. January 19, 2013

    […] http://45.55.223.111/virtualbox-cannot-register-the-hard-drive-because-a-hard-drive-with-uu… IT ← Eine Frage der Fairness Kommentar schreiben0 Kommentare. /* […]

  2. June 21, 2013

    […] Failed to open the hard disk . Cannot register the hard disk becuase a hard disk with UUID already exists. I looked all over the place to find what was causing it and finally found a fix. Of course it requires the command prompt, so open that junk up and let’s get started! **Note that I am on VirtualBox version 4.1.6 and from what I’ve read this command used to be something different a few versions ago. I think instead of setdhuuid it was setvdiuuid, but don’t hold me to that.** Open the Command Prompt Change the directory to where VirtualBox is installed (Default: C:Program FilesOracleVirtualBox) Type the following VBOXMANAGE.EXE internalcommands sethduuid Note that internalcommands and sethduuid need to be lowercase. I spent more than a couple minutes trying to figure out why things weren’t working. 🙂 Below is the output of me changing the ID of the VHD located at C:UsersbschachtVirtualBox VMsWindows XP (VPN) Copy.vhd Source […]

  3. August 3, 2013
  4. April 28, 2014

    […] 来源 […]

  5. September 3, 2014

    […] Error Solving Source […]

  6. August 29, 2015

    […] 方法は VirtualBox – Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists を参照のこと。 […]

  7. November 15, 2016

    […] Thanks to Bradley Schacht for providing the […]

Leave a Reply