Mounting another VM's .vdi in VirtualBox
This is how you add another virtual hard disk to a VM in VirtualBox.
- Go into the VirtualBox Manager and make sure both VMs are shut down
- Right-click on the VM in question and pick Settings
- Go into the Storage category
- Select the controller on which you want to connect the virtual hard disk
- Click the "Add attachment" button and select "Add hard disk" from the popup menu
- Pick "Choose existing disk"
- Tell VirtualBox which hard disk file you want to add, and click Open
When you start the VM the next time, the disk will be available just as if you had installed a second physical hard disk in a real computer.
For me the accepted answer didn't work. I was getting an error message along the lines of
Cannot register the hard disk ... {uuid} because a hard disk ‘...’ with UUID {uuid} already exists.
I found using the command line to change the UUID allowed me to attach the drive originally used in a different VM
VBoxManage internalcommands sethduuid path/to/drive.vdi
Remember !
(Add or set VM)Settings -> Storage -> Adds new storage controller -> Add IDE Controller -> Select the newly added IDE Controler -> click Add hard-disk-> Choose existing disk.
Voilà.