Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant with multiple sync'd folders [closed]

Tags:

vagrant

Is it possible to set more than one sync'd folder in a vagrantfile? Here's my current config (using vaprobash):

# Use NFS for the shared folder config.vm.synced_folder ".", "/vagrant/Sites",           id: "core",           :nfs => true,           :mount_options => ['nolock,vers=3,udp,noatime']  # Use NFS for the shared folder config.vm.synced_folder "../Code", "/vagrant/Code",           id: "core",           :nfs => true,           :mount_options => ['nolock,vers=3,udp,noatime'] 

Only the second mapping gets loaded, the other is ignored-- so I end up with a /vagrant/Code directory mapped properly, but no vagrant/Sites

like image 814
user101289 Avatar asked Jul 28 '15 04:07

user101289


1 Answers

2021 Update:

In 2021 no need for unique Id or being nfs, just list your synced folders:

config.vm.synced_folder ".", "/vagrant/Sites" config.vm.synced_folder "../Code", "/vagrant/Code" 

Original answer:

I just needed to set a unique ID for each mount, and then reload the vagrant box.

# Use NFS for the shared folder config.vm.synced_folder ".", "/vagrant/Sites",       id: "sites", # <--- this ID must be unique       :nfs => true,       :mount_options => ['nolock,vers=3,udp,noatime']  # Use NFS for the shared folder config.vm.synced_folder "../Code", "/vagrant/Code",       id: "code", # <--- different from this one       :nfs => true,       :mount_options => ['nolock,vers=3,udp,noatime'] 
like image 189
user101289 Avatar answered Nov 13 '22 12:11

user101289