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.

Leave a Reply

Your email address will not be published. Required fields are marked *