Move vdi for VirtualBox VM; on same machine

Say you have a hard drive die but were smart enough to have a backup of your Virtualbox VM's vdi hard drive file.  Or, perhaps, you just want to move it for space management.  You might think it would be as simple as moving said vdi file and then pointing the current VM to the new location; WRONG!  VirtualBox will scream with an error that a virtual hard drive already exists with the uuid of the newly relocated virtual disk.  Here's how to fix it. 

1.) First, take note of the uuid (at least the last six characters) as you will use this to find the appropriate reference to the virtusl disk
2.) Simply edit the actual configuration file for that VM with your favorite text editor and point the appropriate "location=" section to the new location of the virtual disk. 
***On OSX it is located under /Users/username/VirtualBox VMs/VirtualMachineName/VirtualMachineName.vbox
3.) Open the *.vbox file and then search for the previously noted uuid
4.) Edit the line referencing the uuid to reflect the new location in the location= field

***One final note is that you will want to make sure VirtualBox is closed when doing this.  Upon relaunching, after editing, you should be able to launch the VM with nary an error.

Comments

Unknown said…
I will definitely keep this in mind the next time I decide to monkey around with VirtualBox.

Popular Posts