Page 1 of 1

How to move "Virtualbox VMs" files

PostPosted: 21. May 2012, 15:40
by vbx4ever
I'm using 4.1.14r77440 and was running out of space on the drive where I store my VM files - Typically C:\Users\[username]\Virtualbox VMs

Maybe I'm not too good at searching for answers but I found all kinds of creative and destructive ways to move the files.
The most common I found is to remove your VMs from the manager without deleting the files. "Remove the VMs from the manager without deleting the files. You can then move the entire VM folder (not just the bare VDIs) to a new location, before adding them back to the manager."

Here's how I did it... Use these instructions at your own risks ;-)

- Shutdown the manager
- Copy the directories under Virtualbox VMs where you want them (full directory - logs, *.vdi, *.vbox*, etc...)
- Locate .Virtualbox folder (mine was in c:\users\[username]\.VirtualBox
- Backup VirtualBox.xml and VirtualBox.xml-prev
- Edit VirtualBox.xml with your favorite editor (or wordpad)
- Locate <MachineRegistry>
- Change the SRC location to the new one...
before <MachineEntry uuid="{afbc1273-1d06-4f6c-9068-e5c044eb4975}" src=" C:\Users\[username]\Virtualbox VMs\XP SP3\XP SP3.vbox"/>
after <MachineEntry uuid="{afbc1273-1d06-4f6c-9068-e5c044eb4975}" src="E:\VirtualBox VMs\XP SP3\XP SP3.vbox"/>
- Save
- Remove files from original location eg C:\Users\[username]\Virtualbox VMs\XP SP3\

Now ready to go to run your VMs from the enw location.

Bingo.

Re: How to move "Virtualbox VMs" files

PostPosted: 21. May 2012, 16:57
by mpack
vbx4ever wrote:The most common I found is to remove your VMs from the manager without deleting the files. Move the vdi files where you want them and recreate the VMs from an existing disk using the new location. By doing such you lose all your settings.

No, that is not the advice.

The advice is to remove the VMs from the manager without deleting the files. You can then move the entire VM folder (not just the bare VDIs) to a new location, before adding them back to the manager.

Manually editing the VirtualBox.xml file is a good and quick solution for those who know what they're doing, but it isn't officially supported, so you do it at your own risk.

Re: How to move "Virtualbox VMs" files

PostPosted: 21. May 2012, 17:15
by vbx4ever
mpack wrote:
vbx4ever wrote:The most common I found is to remove your VMs from the manager without deleting the files. Move the vdi files where you want them and recreate the VMs from an existing disk using the new location. By doing such you lose all your settings.

No, that is not the advice.

The advice is to remove the VMs from the manager without deleting the files. You can then move the entire VM folder (not just the bare VDIs) to a new location, before adding them back to the manager.

Manually editing the VirtualBox.xml file is a good and quick solution for those who know what they're doing, but it isn't officially supported, so you do it at your own risk.


Thanks for the correction - I made the change to the original post to reflect your suggestion.

I did have the "at your own risk" disclamer" :-)

Re: How to move "Virtualbox VMs" files

PostPosted: 12. Feb 2013, 12:10
by ak2766
mpack wrote:
vbx4ever wrote:...
The advice is to remove the VMs from the manager without deleting the files. You can then move the entire VM folder (not just the bare VDIs) to a new location, before adding them back to the manager.


Well, I followed the official method of removing the VM, moving it to the new location, then adding it back in. However, I'm getting the error message as indicated in the attached screenshot - what to do next?

Cheers,
ak.

Re: How to move "Virtualbox VMs" files

PostPosted: 12. Feb 2013, 12:30
by ak2766
I believe I found the solution.

After closing VirtualBox Manager and reopening (not sure if the official documentation includes that step, I got a warning screen (see vbox-warning.png screenshot) informing that the VDI file associated with the moved VM was not accessible. After clicking OK button, the Virtualbox Media Manager screen popped up with an exclamation mark beside the problem VDI file (see problem-vdi-file.png screenshot).

The solution involved removing the problem VDI file from the media manager after which I was successful in adding the VM!

Cheers,
ak.

PS: I'm running VirtualBox 4.2.0 r80737

Re: How to move "Virtualbox VMs" files

PostPosted: 12. Feb 2013, 13:27
by mpack
The official advice assumes that the VM was created using VirtualBox v4.x, and you used the default location for all files. If you deviate from defaults then that's fine, but it's up to you to know then what the consequences are.

There is an outstanding bug that the resident VBoxSVC process remembers registered media even after the VM is removed, and hence gives an error when Machine|Add is use to add back the VM from a different drive. The workaround is to shut down VBox completely and allow several seconds for the VBoxSVC task to unload itself, then you can run VBox and Machine|Add will work.