Moved Virtual Hard Disk

Discussions related to using VirtualBox on Linux hosts.
Post Reply
bf109
Posts: 15
Joined: 12. Mar 2009, 10:15

Moved Virtual Hard Disk

Post by bf109 »

I recently ran out of space on my Ubuntu installation partition so I moved a few of my virtual hard disks to another partition and one of them is showing in the Disk Manager in VBox with an orange exclamation icon now and it has an error when you hover the mouse cursor over it that shows the old path to the VHD and then it says that it cant read the file (obviously, since it is not there) then says VERR_FILE_NOT_FOUND.

I would just move the hard drive back to the original partition and then unregister it in the Disk Manager but I don't currently have enough space to move it back. When I try and register the disk I moved to the other partition is gives me an error basically saying that the disk cant be added since it has the same UUID as the file I moved! :evil:

Is there a way to use vboxmanage to unregister and then reregister the VHD? I could not find any specific commands in the User Manual for this.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Moved Virtual Hard Disk

Post by Sasquatch »

Or open the Media Manager, unregister the faulty HD and then add it again from the proper location.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
bf109
Posts: 15
Joined: 12. Mar 2009, 10:15

Re: Moved Virtual Hard Disk

Post by bf109 »

Sasquatch wrote:Or open the Media Manager, unregister the faulty HD and then add it again from the proper location.
Oops, forgot to mention that the disk manager would not let me unregister the "faulty HD". The buttons are grayed out for "remove" and "release" and the doesn't seem to be a way to unregister the HD from the GUI.
vbox4me2 wrote:Edit the xml files manually.
How would I do this?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Moved Virtual Hard Disk

Post by vbox4me2 »

Search the harddisk and have a look inside them (*.xml)?
dmcgraw
Volunteer
Posts: 808
Joined: 24. Jun 2008, 17:16
Primary OS: Ubuntu 8.10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Ubuntu 9.10
Location: St. Louis, MO, USA

Re: Moved Virtual Hard Disk

Post by dmcgraw »

bf109 wrote:
vbox4me2 wrote:Edit the xml files manually.
How would I do this?
Here is an example of how to do this based on my Virtual Box installation on an Ubuntu host.

VirtualBox by default stores all its files in a directory tree called ".VirtualBox" under the users home directory. The file you want to edit to change the location of the .VDI file which was moved is called VirtualBox.xml. This is the main VirtualBox settings file, so you might want to make a backup copy of it before you modify it. On my system, the full path to this file is:

/home/dave/.VirtualBox/VirtualBox.xml

Open this file in your favorite editor and search down until you find a line something like this:

<HardDisk uuid="{cea3ff0b-920b-491c-d294-4ec25a518750}" location="/home/dave/.VirtualBox/VDI/WindowsXP2.vdi" format="VDI" type="Normal">

This is the definition for the location for one .VDI file in VirtualBox. In the example I have given, you can see the full path to the .VDI file is:

"/home/dave/.VirtualBox/VDI/WindowsXP2.vdi"

It should only be necessary to edit this location to point to the new location of the file you moved.

Dave
bf109
Posts: 15
Joined: 12. Mar 2009, 10:15

Re: Moved Virtual Hard Disk

Post by bf109 »

Thanks for the detailed instructions Dave. I'm very new to Virtualbox so this is a big help. I will try it and post my results.
bf109
Posts: 15
Joined: 12. Mar 2009, 10:15

Re: Moved Virtual Hard Disk

Post by bf109 »

Ok, I opened the file and edited the path to the new path and saved the file then restarted VBox and it did not work. I am wondering if there is an issue with VBox "seeing" the snapshot for this HD in the correct path?? I have one snapshot for this VM which is a W2K3 Server VM.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Moved Virtual Hard Disk

Post by Sasquatch »

When editing files, VB must not run. Else the changes will be reversed.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
bf109
Posts: 15
Joined: 12. Mar 2009, 10:15

Re: Moved Virtual Hard Disk

Post by bf109 »

Well, I ran out of time to be fiddling around with this so I just freed up enough space to move the HD back to the original location. I would like to try this again just to see if I can have some success editing the file manually but for now thanks all for your help.
Post Reply