【问题标题】:Cannot mount vagrant synced folder with nfs无法使用 nfs 挂载 vagrant 同步文件夹
【发布时间】:2014-12-29 06:47:58
【问题描述】:

我设法在 ubuntu vagrant box 中设置了我的 Symfony2 项目。但是通过它的网络服务器加载网站大约需要 20 秒。经过一番研究,我想出了将 nfs 用于同步文件夹。这是我在 Vagrantfile 中的设置:

config.vm.network "private_network", ip: "192.168.56.101"
config.vm.synced_folder ".", "/vagrant", :nfs => true, :mount_options => ["dmode=777","fmode=777"]

启动 de vagrant box 后出现以下错误

==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o 'dmode=777,fmode=777' 192.168.56.1:'/Users/marcschenk/Projects/teleboy.ch' /vagrant

Stdout from the command:

Stderr from the command:

stdin: is not a tty
mount.nfs: an incorrect mount option was specified

虚拟机似乎可以工作,但同步的文件夹显然是空的。我做错了什么?

我的设置:

  • Vagrant 1.6.5 和 Virtualbox 4.3.18
  • 主机:OS X 10.10
  • 来宾:Ubuntu 12.04

【问题讨论】:

  • 您是否在主机上安装了 nfs 服务器?您的客人是否安装了 nfs 客户端? ssh进入guest时可以手动执行错误信息中给出的mount命令吗?
  • 感谢您的回答。一切都安装正确,但我在 Vagrant 文件中有错误的语法。请参阅下面的答案。

标签: macos ubuntu-12.04 vagrant nfs shared-directory


【解决方案1】:

在这里找到问题的解决方案https://github.com/mitchellh/vagrant/issues/2546

vagrant 1.3 到 1.6 的正确语法是:

config.vm.synced_folder ".", "/vagrant", :nfs => { :mount_options => ["dmode=777","fmode=777"] }

【讨论】:

  • 太棒了!这在作为主机的 Mac OS X 上对我有用。 mount.nfs: Protocol not supported 也是错误。
猜你喜欢
  • 2016-04-25
  • 1970-01-01
  • 1970-01-01
  • 2017-10-08
  • 2016-01-08
  • 2017-09-15
  • 2015-09-01
  • 1970-01-01
  • 2017-11-28
相关资源
最近更新 更多