Vagrant: Conditional NFS for Mac/Linux machines
Per default vagrant uses VirtualBox Guest Additions to share your workspace with the vagrant VM. This is okay for Windows machines, but on unixoid hosts this can be quite slow, you should better use NFS here.
Unfortunately, NFS doesn't work out of the box on actual Windows machines. If you are working in a hybrid development environment with Windows and Linux/Mac hosts, you are stuck between a rock and a hard place.
The solution is to use NFS only on machines that support it. The configuration snippet for the VagrantFile looks like this:
if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) == nil
# Use nfs
config.vm.network :hostonly, "192.168.33.10"
config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
# This uses uid and gid of the user that started vagrant
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
end
This works for vagrant 1.0.x, but should also work on later versions.
Written by Pierre Groth
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vagrant
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#