Moving a VM
Posted: 8. Apr 2013, 18:47
Just FYI before we start: The "File|Preferences|General|Default Machine Folder" setting only controls where new VMs will be created, i.e. if you create a new VM, or clone or import a VM then the new/copy VM will go there. This setting does NOT control where existing VMs are to be found, existing VMs can be located anywhere you like. This tutorial tells you how to move one.
Users might want to move a VM for any of several reasons. Perhaps you are running out of space on the original drive, perhaps you want to move the files so that a different user (or all users) can access them. Perhaps you have a new PC and you want to move all your VMs there. Perhaps you are backing up your VM or restoring from a backup. In VirtualBox v4.0.0 and later the folder structure changed so that all files belonging to a VM are stored in a single folder, the "VM folder", which makes it easy to move a VM whatever your reason might be.
VirtualBox v6.x and later
VirtualBox v6.x has made it easier still to move a registered VM around on a single host: just right click the VM in the manager and select "Move...". If for some reason the built in feature isn't suitable (e.g. the VM not registered), or if you want to move the VM to a different host then read on, as the v4 method still works...
VirtualBox v4.x and Later (a.k.a. Manual Method)
The basic procedure for moving VMs created by VirtualBox v4.x and later is to copy/move the VM folder (with contents) to your preferred location, then use the manager's Machine|Add menu item to register the .vbox file (found in the VM folder) from its new location. On some hosts e.g. Windows you can simply double-click the .vbox file to register the VM.
Of course, if the copy is on the same host as the original VM then VirtualBox will object to your attempt to register the same UUID twice (*). You must remove the original VM from the manager before the copy can be added (**).
(*) If you want the original and the copy to be registered at the same time on the same host then you actually need to make a clone rather than a simple copy. To clone a VM you right click it in the GUI and select "Clone". [ VirtualBox v4.1.0 and later ].
(**) There was a bug in VirtualBox versions prior to v4.3.0 in which the background VBoxSVC process retains a memory of media filenames and UUIDs even after the front end has apparantly removed them. If using an affected version then to work around this you must shut down VirtualBox entirely, wait several seconds or until VBoxSVC unloads, then you can run the GUI again. At this point you should be able to add the VM back without complaint.
If you are running on a Windows host then be wary of moving VMs to removable storage. Windows has a nasty habit of changing the drive letters of removable drives, which will invalidate the VM path stored when you used Machine|Add.
Users might want to move a VM for any of several reasons. Perhaps you are running out of space on the original drive, perhaps you want to move the files so that a different user (or all users) can access them. Perhaps you have a new PC and you want to move all your VMs there. Perhaps you are backing up your VM or restoring from a backup. In VirtualBox v4.0.0 and later the folder structure changed so that all files belonging to a VM are stored in a single folder, the "VM folder", which makes it easy to move a VM whatever your reason might be.
VirtualBox v6.x and later
VirtualBox v6.x has made it easier still to move a registered VM around on a single host: just right click the VM in the manager and select "Move...". If for some reason the built in feature isn't suitable (e.g. the VM not registered), or if you want to move the VM to a different host then read on, as the v4 method still works...
VirtualBox v4.x and Later (a.k.a. Manual Method)
The basic procedure for moving VMs created by VirtualBox v4.x and later is to copy/move the VM folder (with contents) to your preferred location, then use the manager's Machine|Add menu item to register the .vbox file (found in the VM folder) from its new location. On some hosts e.g. Windows you can simply double-click the .vbox file to register the VM.
Of course, if the copy is on the same host as the original VM then VirtualBox will object to your attempt to register the same UUID twice (*). You must remove the original VM from the manager before the copy can be added (**).
(*) If you want the original and the copy to be registered at the same time on the same host then you actually need to make a clone rather than a simple copy. To clone a VM you right click it in the GUI and select "Clone". [ VirtualBox v4.1.0 and later ].
(**) There was a bug in VirtualBox versions prior to v4.3.0 in which the background VBoxSVC process retains a memory of media filenames and UUIDs even after the front end has apparantly removed them. If using an affected version then to work around this you must shut down VirtualBox entirely, wait several seconds or until VBoxSVC unloads, then you can run the GUI again. At this point you should be able to add the VM back without complaint.
If you are running on a Windows host then be wary of moving VMs to removable storage. Windows has a nasty habit of changing the drive letters of removable drives, which will invalidate the VM path stored when you used Machine|Add.