This quick tutorial is going to cover about where does Vagrant store its boxes after downloading.
1. Where does Vagrant store its boxes?
By default, Vagrant stores its boxes after downloading in the directory defined by VAGRANT_HOME environment variable. As a result,
- On Mac OS X and Linux: ~/.vagrant.d/boxes
- On Windows: C:/Users/USERNAME/.vagrant.d/boxes
2. Change the directory where Vagrant stores its boxes?
There are some situations that we may want to change the directory where Vagrant stores its boxes to other directories such as to backup the boxes, to reduce disk space on the main partition, etc. In such a case, we can change the VAGRANT_HOME variable to our desired location.
Here is an example how we can change the VAGRANT_HOME environment to another location on Unix-like systems:
1 |
export VAGRANT_HOME=/data/vagrant |
On Windows, we can use the “setx” command, for example:
1 |
setx VAGRANT_HOME "D:\data\vagrant" |
Or you can:
- Open Control Panel –> System –> Advanced System Settings –> Advanced –> Environment Variables –> New
- Enter Variable Name is VAGRANT_HOME
- And enter the Variable Value is your desired location, for example:
3. Conclusion
The tutorial has show us the location where does Vagrant store its boxes. We can see that Vagrant stores its box in the location specified by the VAGRANT_HOME environment variable. As a result, we can change that location to another one by simply changing the environment variable.
Below are other related articles for your references:
Set Name, Number of CPUs, Memory and GUI Mode for Vagrant Virtual Machines
Running Vagrant SSH on Windows
How to Add a Vagrant Box from Local or Remote
Copy Files and Folders From Host To Guest In Vagrant
How To Change Vagrant Virtual Machine Name