Problem
I recently switched to a new machine, and for various reasons some of my Vagrant boxes didn't transfer in the migration. vagrant status
resulted in a status of "not created (virtualbox)".
Since Vagrant boxes are supposed to be disposable and reproducible, in most cases this was fine.
But there were a couple that I wanted to transfer as-is. This is how I did it.
Solution
- On the first machine, halt the Vagrant box.
- Copy the actual VirtualBox machine files. On the Mac, these are in
~/VirtualBox VMs
. - Open the VirtualBox GUI, and choose Machine > Add.
- Navigate to the machine and add it, so that it appears in the VirtualBox GUI.
- Under the Vagrant project directory, copy the files for the Vagrant box in question under
.vagrant/machines
into the.vagrant/machines
directory under the corresponding Vagrant directory on the new machine. - In the Vagrant directory, double-check the machine's status with
vagrant status
. It should be "poweroff" instead of "not created". - At this point, you should be able to run
vagrant up
orvagrant reload
as normal.