加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Vagrant:如何为Windows主机禁用NFS同步文件夹?

发布时间:2020-12-14 04:38:18 所属栏目:Windows 来源:网络整理
导读:我们需要与 Linux,MacOS和Windows主机共享VM.但是,对于Linux和MacOS,建议使用NFS共享,但对于Windows,不支持NFS共享. 有没有办法检测主机操作系统是Windows并禁用NFS共享? 解决方法 流浪汉1.2.5 实际上已经在Vagrant 1.2.5中进行了处理,参见Option for NFS i
我们需要与 Linux,MacOS和Windows主机共享VM.但是,对于Linux和MacOS,建议使用NFS共享,但对于Windows,不支持NFS共享.

有没有办法检测主机操作系统是Windows并禁用NFS共享?

解决方法

流浪汉1.2.5

实际上已经在Vagrant 1.2.5中进行了处理,参见Option for NFS is not silently ignored on windows hosts和相应的提交b2d1a26 (NFS request is silently ignored on Windows):

?

@__synced_folders.each do |id,options|
  # Ignore NFS on Windows
  if options[:nfs] && Vagrant::Util::Platform.windows?
    options[:nfs] = false
  end
end

上一个解决方法

如果你无法升级,你可能想尝试Ryan Seekely的Vagrant and using NFS only on non Windows hosts:

Well,since a Vagrantfile is nothing but a Ruby script,we can just
use Ruby! At the top of the Vagrantfile define:

06001

And then when configuring your shared folder:

06002

请注意,我实际上没有测试过这个特定的解决方案,但之前我一直在使用概念上类似的方法,尽管使用的是Vagrant :: Util :: Platform.windows?正如官方承诺(现在没有方便…).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读