Search code examples
vagrant

Correct way to back-up and restore vagrant box + Variable VVV


I have a vagrant box (ubuntu/trusty64) installed on my MacBook. I have extended this box with Variable VVV --> https://github.com/bradp/vv#os-x-installation This enables me to create fresh WordPress installs (currently I have around 10 installs).

I want to completely clear out my MacBook and install a fresh version, but I don't want to lose my box and all of my projects. How can I tackle this problem without losing my projects?


Solution

  • You need to backup your box, your project directory and the virtualbox folder with all the VM.

    Those are the following:

    • ~/.vagrant.d folder all together

    This folder has all your downloaded boxes (under the ~/.vagrant.d/boxes folder) but also has the references of all the VM that are active under vagrant management

    • Your project directory

    save the folders where you have Vagrantfile, they also contains a .vagrant directory, under this folder there is file with the reference of the VM linked with this Vagrantfile

    • The VM directory

    I am not sure the default value but should be ~/VirtualBox VMs. Backup this directory which contains the VMs created by vagrant

    After you have cleaned up your macos, you need to make sure you reinstall those folders at the same location