Vagrant.d outside the home folder

I have a problem with the fact that my home directory is located on a remote server and with ~ / .vagrant.d sits on this server, the performance of vagrants is greatly reduced (and the size of the file server backup is increasing).

So, is there a way to move at least ~ / vagrant.d / boxes from the home directory?

Greetings.

+62
vagrant
Feb 06 '13 at 16:16
source share
5 answers

By default, Vagrant uses ~/.vagrant.d . Fortunately, the stroller provides an environment variable called VAGRANT_HOME , with which you can set up a stray house.

Just follow these steps to change the home of the vagabonds (this only works in the current session)

export VAGRANT_HOME=/path/to/vagrant

To make it persistent, add it to your ~/.bash_profile (for login shell).

Update : VAGRANT_HOME added to documentation - Environmental variables

VAGRANT_HOME can be set to change the directory in which Vagrant stores global status. The default value is ~/.vagrant.d . Vagrant's home directory is where things, such as boxes, are stored, so it can actually become quite large on disk.

+93
Feb 11 '13 at 1:27
source share

VAGRANT_HOME does not work on my Windows 8.1. This worked for me when I changed the file

D: \ HashiCorp \ Vagrant \ Embedded \ Gemstones \ Gemstones \ Stray-1.5.3 \ Lib \ Stray \ Environment.rb

at line 117 on

 @home_path = Util::Platform.fs_real_path("D:/vagrant/home/") 

as Steve X said, and it works great.

+13
May 10 '14 at 15:03
source share

It might be useful to constantly set this in a Windows window by doing

 setx VAGRANT_HOME "/d/.vagrant.d/" 
+9
Mar 25 '15 at 9:58
source share

On Windows, change line 17 of the .rb environment located at:
tramp \ embedded \ gems \ gems \ vagrant-1.xxdev \ Lib \ bum \ environment.rb

+7
Mar 14 '13 at 1:50
source share

another place (the root place where he reads ENV variables) is in shared_helpers.rb, line 71 (vagrant v 1.6.5):

  # This returns the path to the ~/.vagrant.d folder where Vagrant's # per-user state is stored. # # @return [Pathname] def self.user_data_path # Use user spcified env var if available path = ENV["VAGRANT_HOME"] # On Windows, we default to the USERPROFILE directory if it # is available. This is more compatible with Cygwin and sharing # the home directory across shells. if !path && ENV["USERPROFILE"] path = "#{ENV["USERPROFILE"]}/.vagrant.d" end # Fallback to the default path ||= "~/.vagrant.d" Pathname.new(path).expand_path end 

In any case, I think the best way is to use the environment variable VAGRANT_HOME in case of updating the stray version.

You can use this function, for example:

 disk_path = self.user_data_path().to_s 
+2
Sep 09 '14 at 7:24
source share



All Articles