有多个同步文件夹的流浪汉

时间:2015-07-28 04:43:02

标签: vagrant

是否可以在vagrantfile中设置多个sync" d文件夹?这是我当前的配置(使用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']

只有第二个映射被加载,另一个被忽略 - 所以我最终正确地映射了/vagrant/Code目录,但没有vagrant/Sites

1 个答案:

答案 0 :(得分:47)

我只需要为每个装载设置一个唯一的ID,然后重新加载流浪盒。

# 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']