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.**
- Open the Command Prompt
- Change the directory to where VirtualBox is installed (Default: C:Program FilesOracleVirtualBox)
- 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
Thanks a bunch Bradley. You made my day!
Glad I could help!
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 ******************
Thanks Bradley. Precisely what I was looking for and worked first time.
Cheers!
Thanks a lot Bradley!!!
Thank you very much, it works very fine.
I tried some things before and I read some hints but nothing has worked.
thank you!
Great save, thanks for sharing.
Thanks! That worked!
That worked! Thank you very much!
Thank you
Great Post man !
You made my day … was planning to reinstall and dunno what more 🙂
Cheerz Guby
Excellent help. Made handling this problem quick and easy
Thank you so much for posting this
Thanks! Worked like a charm!
Thanks a lot!!!!
Muchas gracias, muy precisa tu ayuda!
Worked like a charm thanks.
I had to run the command agains my *.vdi image instead of *.vhd
Thank you! Can confirm that this also works on osx:
VBoxManage internalcommands sethduuid /PATH/TO/DISK.vdi
Awesome, just what I was looking for.
You the man!
I love simple and quick fixes.
You the man, Bradley!
Thanks !
a quick search in Google and there is the solution, thanks!
Thanks! Just the info I needed to make this work 🙂
Excelente viejo!!! funciona de lujo!.
Thanks Bradley!!!
Most helpful!
Thank’s for this, under linux upper and lower are very important you must use
VBoxManage internalcommands sethduuid
Cheers for that! worked a treat!
Thanks very much, great help
Got a better solution.
Swap the folder names of the images.
For example ubuntu and ubuntuNew
you change into ubuntuOld and ubuntu
Thanks for this, good of you to share this knowledge gem…
This is what I needed. Thanks!
good tip! thanks
Thanks a lot.
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
That worked. Thanks so much.
Second this, the command is doing exactly the same thing, with the added trouble of having to work with the windows command prompt.
thanks. appreciate it very much
Thanks for posting a solution for this annoying problem! Appreciated very much
solve my problem!
Thanxs!
yeah, my english is sux, so what?
Thank you, this worked for me (on Win8)
Thank you, it worked on VirtualBox 4.2.6!
Worked for me also, thanks
It work for me too (using Window 7, VirtualBox 4.2.0). This is a great finding. It is simple and easy.
Thanks dude! Never would have figured out what command line bullshit to execute.
[…] http://bradleyschacht.com/virtualbox-cannot-register-the-hard-drive-because-a-hard-drive-with-uu… IT ← Eine Frage der Fairness Kommentar schreiben0 Kommentare. /* […]
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
Thanks for the fix!
Thanks, this really helped me out. I was stuck in the muddled mess which is the virtualbox forums, this is exactly what I needed
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”
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.
thank u very much for this post………………..
yo sooo rock!
Thanks . May Allah bless you.
Thanks! That worked!
Thanks a million! You made my day!
Thank you.. your solution worked for me. I had moved the VirtualBox HD to a new drive and was hanging…
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.
And this helped ME immensely. 🙂
Thanks.
Thanks. Great contribution
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…
Thanks a lot for this. Really helped me out!
thanks a lot bradley
Thanks you very much. I resolved this problem.
Didn’t help, using 4.2.4
[…] 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 […]
Thanks, brought my XP VM back to life 🙂
Many, many thanks.
Thank you 🙂
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
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!.
My emergency rescue! A really good hint that worked perfectly!
Many thanks !!
It worked. Thanks a lot.
[…] http://bradleyschacht.com/virtualbox-cannot-register-the-hard-drive-because-a-hard-drive-with-uu… […]
Thank you, It worked for me too!
Very usefull
Thanks. Useful information well presented.
Thank you
Really cool, thanks for posting this. You saved me hours of searching!
Thanks a lot.
Thanks man, works on OS X too! (without exe though 😛 )
Thanks a Lot, man!
Great, bro! It still works at 4.2.18!
Thanks for sharing ! I have the same problem here with Virtual Box and VHD file
lovely, thanks.
Thanks big time.
Thanks a lot Bradley ! you saved me
Now my VirtualBox ver. 4.02 is working !
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 🙁
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.
Worked perfectly for a copied VM, thanks!
Thanks a lot mate, really helped 🙂
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.
Nice one Jon Gilbert!
Thank you. It works for 4.3.8 version! Cheers!
Thanks a lot )) Really helped
Thank you! Awesome solution.
[…] 来源 […]
Thanks. Really helped.
works with version 4.3.10. 🙂
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.
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.
Thanks! It worked for me in Linux:
$ vboxmanage internalcommands sethduuid /path/to/new/file.vdi
This worked for me on Windows 7. Thanks so much man! Very helpful guide.
Thanks this worked perfectly for me and saved me time 🙂
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 😀
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.
Good idea 🙂
thanks very much
[…] Error Solving Source […]
Thanks very much, it works!
Thanks, it just works
Thanks! It really helped. This issues with copying VMs are really annoying.
Thanks ! Worked when I had ro rename my virtual PC and .vdi file.
Works for me as well, thank you!
Great!! Worked!
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 🙂
Thanks a lot. Exactly what I was looking for. And it works 🙂
vboxmanage internalcommands sethduuid
for whatever reason was not in the first comment
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
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
thanks man. Big help .
Bradley, thanks. It works! 🙂
Muchas gracias, desde México
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
It works, but changes the hardware ID of the VM :/
Better way:
1. File > Virtual Media Manager
2. Choose the Hard drive that you want to remove
3. Release
4. Remove
Done!
Thanks. This way through the UI worked for me. I had already removed this HD from my list of Machines, and I think that made pressing the “Release” button not needed.
You Hero! Do it this way! works great.
Excellent!!!
Thank you!
Thank you!!!
Good post. Many thanks.
Thanks to sharing the info.
Thx!!
Works perfect! Thank you!!!
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! 🙂 )
thank you!
Works fine. Thank you!
Thanks! This helped.
Just what I needed, thanks.
Worked very well. Thanks a lot.
[…] 方法は VirtualBox – Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists を参照のこと。 […]
Still works! Thanks!
Thanks a bunch! Got me out of trouble when trying to find an older project on one of the company’s older, retired vms.
Thanks!
thank you so much …its really nice and worked in one shot.
Thanks mate
Thanks for making this, probably spared me an hour or two there!
Thanks! 🙂
Thanks a lot from Düsseldorf
Thanks ! it really works for me
Many thanks
Awesome! Thanks man!
Thanks for the article, helped me a lot!
this is really amazing. it works perfectly, thank you for sharing
Thank you very much!!!!!!!!!!!!!!!
Thank you – it works
Thanks a lot.
This post helped me solve my issue quickly without having to waste any time in forums looking for the right answer 🙂
[…] Thanks to Bradley Schacht for providing the […]
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 ?
Works Great
[…] VirtualBox – Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists […]
Thanks a ton.
Bless you! Saved me a heck of a lot of time and frustration.