Tag Archives: virtualbox

Moving over VirtualBox/Vagrant the easy way

There is a right way to move/copy over a VirtualBox to a new computer/colleague/etc.

Step 1 – Package up the old box

Run a command prompt and switch into the directory that contains the Vagrant box that you want to copy.

NOTE: Make sure that the box has been properly shutdown/powered off from VirtualBox manager.

vagrant  package  --output  project_20XX_XX_xx.box

==> default: Exporting VM...
   (about 10 minutes passed)
==> default: Compressing package to: c:/home/project_20XX_XX_xx.box
   (about 7 more minutes passed)
   (then complete.  Back to c:\

On my ThinkPad X1 Carbon with Intel I7-6600 CPU @2.7 GHz and 16GB ram, it took xyz minutes to create a xxx GB .box file.

Step 2 – Copy the .box file

Next, copy over the c:/home/project_20XX_XX_xx.box to the computer/directory you want it in. You might need

 vagrant  box  add  project  project_20XX_XX_xx.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'project' (v0) for provider:
    box: Unpacking necessary files from: file://c:/home/project_20XX_XX_xx.box
    box: Progress: 100% (Rate: 104M/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'project' (v0) for 'virtualbox'!

Next, fire it up

vagrant  init   project
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.


vagrant  up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'jbv2'...
Progress: 90%
==> default: Machine booted and ready!

SSH in and you are good to go.

Moving over VirtualBox/Vagrant the hard way

There is a right way to move/copy over a VirtualBox to a new computer/colleague/etc.

And then there is the hard way.  What is the hard way?  The hard way is when you need to manually copy over .vbx and .box files and edit .xml files. 

Step 1 – Copy files over from the old drive.

Copy over the directory that contains the .vagrant folder. The way I have my environment it’s “c:\home\blah”.  I do by having 2 windows explorer windows open, and dragging and right-clicking on the destination folder, then clicking “Copy here” or “TerraCopy here.”

Take note of the value of c:\home\blah\.vagrant\machines\default\virtualboxes\id

067c8f42-0e93-4825-a02a-8ecf3a6586d3

Next, copy over the c:\Users\YOURNAME\VirtualBox VMs\xxx folder that corresponds/correlates to your Vagrant box.

Then, double click on the .vbox file in the directory you just copied over. This should automatically import it into VirtualBox.

Finally, open up c:\Users\YOURNAME\.VirtualBox\VirtualBox.xml and check that the uuid matches.

      <MachineEntry uuid="{aaaaaaa-bbbb-cccc-dddd-eeeeeeeeee}" src="C:/Users/YOURNAME/VirtualBox VMs/xxx/xxx.vbox"/>
    </MachineRegistry

Fire up your cmd prompt, switch to the c:\home\xxx\ directory and

vagrant up

Celebrate!