26th Jun2014
Author: Gyro

VirtualBox – moving a VDI file and re-linking it to the Guest

virtualbox

Today I decided to move my vdi files to another partition.
So, I moved them and then started the Oracle VM VirtuaBox Manager to re-link the vdi files to the respective guest.First, I opened the settings of each Virtual Machine and deleted the "old" hard disk under "Storage".Then I clicked on "Add Attachment", selected "Add Hard Disk" and "Choose existing disk", and then selected the vdi file.

Next came a very strange error:

The Problem

Cannot register the hard disk ‘FULL PATH TO NEW LOCATION OF VDI' with UUID {UUID OF THE VDI} because a hard disk ‘FULL PATH TO OLD LOCATION OF VDI' with UUID {UUID OF THE VDI} already exists in the media registry (‘/home/user/.VirtualBox/VirtualBox.xml').

This confused me pretty good, as I knew for a fact that I moved the vdi, so it did not exist at the old location anymore. I also had no clue what this media registry was supposed to be, and before opening that xml file and messing around with it, I decided to see if others had this issue before.

After a bit of google-ing, I found the solution in the VirtualBox forum:

Even though the thread was started on 2. Mar 2009, 16:43, some kind soul decided to register to the forum to make one single post to the forum in this thread on 21. Dec 2012, 22:00 (Christmas spirit?) with the simple solution to this problem.

Hi there,

I had the same UUID problem and a very easy fix worked for me. I went File>virtual media manager. I found the vdi file that was giving me issues. Selected it and removed (though it was showing up as inaccessible). Then started the VM again and selected the file from my local hard-disk. That was it!
Hope this works for you too. :)
Om

So, to summarize with a bit more clarity:

The Solution

1. Open the Oracle VM VirtuaBox Manager
     Click on File -> Virtual Media Manager (or Ctrl+D)
2. Delete the hard disk entry in question (select and press "Del" on keyboard)
3. Open "Settings" of the Virtual Machine, go to "Storage", click "Add Attachment", select "Add Hard Disk" and "Choose existing disk", then selected the vdi file and you are done.

Enjoy :)

92048

Keep Me Going



Your Name / Website :


Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW



26 Responses to “VirtualBox – moving a VDI file and re-linking it to the Guest”

  • Dimitri

    Thanks!!!!

  • Gerardo Ariel

    Man, thanks a lot for this! It was so easy, and there were so many weird solutions on the net that are nonsenses.
    Thankfully I kept searching and found your post! Cheers and good luck!

  • Gary Heard

    Can only say thanks, I’d trawled that thread but missed what you picked up.

    Thanks for finding it and for putting it up there

  • Walter

    Unfortunately the suggested procedure did not work for me as the “Remove” option in the Virtual Media Manager was grayed out. The same applies to the “Release” option.

    • Gyro

      Normally, “remove” is only grayed out when the drive is still attached to a guest, and “release” in grayed out when a disk is no longer attached to a guest, but I have never seen both of them grayed out at the same timeh…

      Which Host OS do you use?

      Looking at the terminal commands, I think you could just do: ~$ VBoxManage storagectl uuid-of-the-drive –remove

      That’s 2 dashes infront of the ‘remove’, I need to fix the way that is displayed… actually I need a new theme, as this one isn’t even mobile friendly…

      To get the uuid of the drive you want to remove: ~$ VBoxManage list hdds

      You will see something like this:

      UUID: e294fc8b-7414-48be-bef4-80e1dc76edcf
      Parent UUID: base
      State: created
      Type: normal (base)
      Location: /home/gyro/VirtualBox VMs/Android-x86/Android-x86.vdi
      Storage format: VDI
      Capacity: 59578 MBytes

  • Frenk

    Thanks!!!

  • javad

    Thanks man it helped….

    • Gyro

      Thank you for your comment, it makes my day to know I was able to help someone :)

  • antony

    THANKS!!!!!!!

  • Klerio Silveira

    Thanks man. You helped me. All fixed.

  • Fernando H

    Wow. So many strange workarounds and somewhat complicated methods on the internet, and this worked. Thanks!

  • Thanx a lot, you rocks!

  • ommit

    Worked like a charm. Thank you.

  • Edy

    Thanks a lot, very nice and simple solution

  • Jeremy

    I had this problem many many months ago and found a command line solution that fixed the problem (I recall changing/assigning a new UUID to my storage file). However I forgot what I did.

    THANKFULLY, i found this simply solution. Thanks again.

  • Eslam MOSTAFA

    Thanks ver much ,you really help me

  • Leo

    Man, this is so simple and nobody knows that!! Thanks for sharing! The only post that helped me! Thanks!!

  • viki

    thanks…saved hours of trouble

  • Sujith John

    Thank you !!!!!!!!!!! helped ! been trying to edit the .xml file and went all around the place.

    Thanks again!!

  • Nour Alhadi

    I can surely say…
    Many thanks to you my friend
    your the best online :-)

    • Gyro

      I think the best would deserve a coffee. I didn’t get one, so… :)

      Thanks for the kind words and making my day.

  • Road

    THANKS!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 2 + 4 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)