Moving Virtual Box VM’s – The other day I created a VM in VirtualBox, and it created the VM in the default directory on my local drive. My local drive is not full, but having a virtual machine hogging an initial 23 Gb of disk space, didn’t excite me too much. This is especially true if it is set to dynamically grow in size. As I found out, moving VirtualBox VM’s is really quick and easy. Here’s how.
Moving VirtualBox VM’s
The current version of my Virtualbox installation is 4.2.14r86644. The first step is to ensure that the virtual machine is powered off.
Navigate to the settings for the specific VM you want to relocate. Click on the Storage item and select your vdi file (your hard disk). Click on ‘Remove Attachment’.
When you have done that, click on OK and then open up the Virtual Media Manager from the VirtualBox file menu.
Select your vdi file again from the Hard drives tab and click on the Remove button.
VirtualBox will now prompt you to confirm your selection to remove the hard disk (unless you selected not to show this message at an earlier time). Click on the ‘Remove’ button.
Because we want to relocate the VM, you need to keep the hard disk. If you delete it here… well, just don’t.
Once you have done that, go the the disk location for your VM (mine was at “C:Users[username]VirtualBox”, but your path will be different) and copy it to your external drive. Go make a cup of coffee.
When the disk has been copied, you need to select the settings for your VM again and click on the Storage menu. This time, click on the ‘Add Hard Disk’ button.
VirtualBox then asks you if you want to create a new disk or add an existing one. We want to use the disk we copied on to our external drive. Click on ‘Choose existing disk’ and browse to the location on your external drive.
VirtualBox will then add the disk on your external drive to your storage tree. Click OK and start your VM.
Lastly, don’t forget to remove the old VM from the location it originally was created in. Having my VM on an external Hard Drive allows me to free up space on my development machine. Another good idea is to Export Appliance once you have your VM set up just right. That way you can import it if you need to create a new VM or distribute it to others in your organization.