Vagrant is a pretty nifty tool that simplifies developing on a Virtual Machine. However it is sometimes not obvious what happens in the background! An example of this is where your VM’s actually get downloaded to, and how they are managed.

Since Vagrant acts as a wrapper for VirtualBox (or VMWare Fusion more recently) when you “add” a box, it essentially downloads a pre-built Virtual Machine Disk (VMDK) from the internet/network and stores it somewhere. It then uses this as a base before applying your project-specific configuration, such as Shared Folders, networking and so on.

The VMDK’s get downloaded to a hidden sub-directory in your home directory.

cd ~/.vagrant.d/boxes/

Therefore if you run a command in your project (as per the tutorial) such as

vagrant box add precise32 \
    http://files.vagrantup.com/precise32.box

Then assuming you are using VirtualBox (as boxes will be stored differently depending on which virtualization provider you are using) the box will be downloaded to the following location

cd ~/.vagrant.d/boxes/precise32/virtualbox

If you look what is in there, you will see a VMDK, Vagrantfile describing the box, Open Virtualization Format (OVF) file for VirtualBox (so VirtualBox can import it, I assume you’ll get a VMX for VMWare Fusion) and a metadata JSON file telling Vagrant the provider (in this case VirtualBox)

ls
Vagrantfile  box-disk1.vmdk  box.ovf  metadata.json

You can then boot up the Virtual Machine using

vagrant up

vagrant up is the equivalent of running VBoxManage startvm $NAME –type headless orVBoxHeadless –startvm $NAME i.e. starting the VM up headless (without a virtual monitor attached), but it handles various other configuration like the port forwarding, etc. at the same time

You can then SSH into the VM using

vagrant ssh

vagrant ssh is the equivalent of SSH’ing into the VM, but as Vagrant has already taken care of the port forwarding and virtual networking for you, it connects to the VM on a host-only network using the IP it setup for it during vagrant up

So even though Vagrant is essentially a wrapper for VirtualBox/VMWare, it takes care of quite a lot of things for you!