How to move VirtualBox files?
(Edit: As of 6.0.4 there is now a built-in function to move a VM. See https://superuser.com/a/1401548/120738)
If you mean to MOVE all your VM to an entirely new location, you should just follow these 2 replies:
- https://forums.virtualbox.org/viewtopic.php?f=1&t=48258#p219275
- https://forums.virtualbox.org/viewtopic.php?f=1&t=48258#p219285
Copying the post here:
- Shut down VirtualBox, back up your .VirtualBox\VirtualBox.xml file.
- Find your existing "Virtualbox VMs" folder, and copy (not move) the whole folder with contents to your new drive E:
- Run VirtualBox, then for each VM in turn:
3.1 Right click the VM name and select "Remove" from the popup menu. Answer no to the "physically delete files?" question.
3.1b after removing a VM from the UI you have to close VirtualBox, and leave it closed for long enough for the background VBoxSVC task to time out and terminate also. Then you can start the VirtualBox app again and use Machine|Add to add back the VMs removed in the previous step.
3.2 Select the Machine|Add.. menu item, navigate to the VMs new location on drive E:, and select the .vbox file.
3.3. Repeat for any remaining VMs. 4. In File|Preferences, set the default machine path to "E:\VirtualBox VMs" 5. Test each of the VMs. Only after you are sure they all work, delete the old VM containing folder, i.e. delete "C:\VirtualBox VMs".
(Edit: As of 6.0.4 there is now a built-in function to move a VM. See https://superuser.com/a/1401548/120738)
I only had a couple of VMs, and I found that I could just change the default storage location for VirtualBox and then clone my VM's. The clones where created in the new location on the new HD where I wanted them. Everything intact, snapshots and no need to remap the location of the virtual HDs.
The easiest method doesn't require removing your virtual machines and mucking up their settings.
Copy your Virtualbox VMs folder to a new drive.
Run the Virtual Box Machine Manager. Run the media Manager File -> Virtual Media Manager
2a. Choose the VM to move storage for. Click the Release button and then the Remove button. On the next dialog, you can either remove or keep the virtual drive. Close the manager leaving you in your Virtualbox Machine Manager.
Select the VM you just removed media for, click the Settings button, Click the Storage section. Add a controller for the media (SATA usually) and then add a hard drive and choose existing disk and select the VD at your new location.
Repeat for each machine you're moving
Fire off your virtual machine at the new location to check. Next time you visit the Virtual Media Manager, hovering over the VM entry will show you where the VD is stored.
Make sure you change your snapshots folders to point to the new drive if you're using them. Each machine has a snapshot folder setting and the VM Manager has a Default Machine folder setting in File -> Settings that needs to be changed as well.
In addition I had to also modify path in xml file. After that it worked flawlessly.
NOTE: Things have changed a bit since this was written, see Rob's answer. It's extremely simple now.