How to move "Virtualbox VMs" files

Discussions related to using VirtualBox on Windows hosts.
Post Reply
vbx4ever
Posts: 12
Joined: 20. Nov 2011, 18:48
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Microsoft for now

How to move "Virtualbox VMs" files

Post 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.
Last edited by vbx4ever on 21. May 2012, 17:12, edited 1 time in total.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to move "Virtualbox VMs" files

Post 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.
vbx4ever
Posts: 12
Joined: 20. Nov 2011, 18:48
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Microsoft for now

Re: How to move "Virtualbox VMs" files

Post 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" :-)
ak2766
Posts: 3
Joined: 12. Feb 2013, 12:02

Re: How to move "Virtualbox VMs" files

Post 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.
Attachments
Error on adding VM back in after moving to new location.
Error on adding VM back in after moving to new location.
add-after-move-error.png (53.26 KiB) Viewed 40620 times
ak2766
Posts: 3
Joined: 12. Feb 2013, 12:02

Re: How to move "Virtualbox VMs" files

Post 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
Attachments
Problem VDI File
Problem VDI File
problem-vdi-file.png (50.34 KiB) Viewed 40618 times
Warning on VirtualBox Manager Launch
Warning on VirtualBox Manager Launch
vbox-warning.png (31.64 KiB) Viewed 40618 times
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to move "Virtualbox VMs" files

Post 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 used 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.
Post Reply