Vagrant Windows synced_folder - 没有那个文件或目录

Vagrant Windows synced_folder - no such file or directory

我最初认为 vagrant-winnfsd 插件会处理 Windows 上的 NFS 存储(这意味着我不必使用 haneWIN)但那是不行的,因为错误我收到的是 mount.nfs: requested NFS version or transport protocol is not supported.

重新激活 haneWIN 后,我现在收到此错误:mount.nfs: mounting 172.28.128.1:/D/git-repositories/+vm failed, reason given by server: No such file or directory

我的印象是 [URL]:[mount] 格式不正确,因为在另一个 VM 上,我在 fstab 中使用以下内容手动设置了我的挂载:192.168.11.2:/websites /home/vagrant/rails nfs nfsvers=3,vers=3,rsize=8192,wsize=8192,timeo=14,auto,intr,udp,nolock,exec,rw,user.

给定以下配置,Vagrant 的尝试应该看起来不像 172.28.128.1:/websites 吗?


主机OS:Windows 7 x64,局域网IP:192.168.11.2
嘉宾OS:Ubuntu/trusty64
虚拟器:Virtualbox 5.0.20 r106931
相关插件:vagrant-winnfsd
主机 OS NFS 服务器:haneWIN NFS 服务器

NFS 服务器导出: D:\git-repositories\+vm -name:websites


Vagrantfile 摘录:

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, type: :dhcp, auto_config: false

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network :public_network,
                  ip: '192.168.11.14',
                  bridge: 'Realtek PCIe GBE Family Controller'

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
#
# Do not share root directory of vagrant
config.vm.synced_folder '.', '/vagrant', disabled: true
# Share ruby repository directories
config.vm.synced_folder 'D:/git-repositories/+vm',
                        '/home/vagrant/apps',
                        nfs: true,
                        mount_options: [
                          'nfsvers=3',
                          'vers=3',
                          'actimeo=1',
                          'rsize=8192',
                          'wsize=8192',
                          'timeo=14',
                          :nolock,
                          :udp,
                          :intr,
                          :user,
                          :auto,
                          :exec,
                          :rw
                        ]

我的猜测是正确的。 vagrant-winnfsd 不允许您在 IP 地址后明确设置路径 - 它始终包含前面的驱动器号。我的解决方案是设置 haneWIN NFS 服务器导出名称以匹配 Vagrantfile 使用的驱动器号。

请记住,Vagrantfile 位于驱动器盘符 I:\ 上。

NFS 服务器导出: D:\git-repositories\+vm -name:I

Vagrantfile 摘录:

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, type: :dhcp, auto_config: false

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network :public_network,
                  ip: '192.168.11.14',
                  bridge: 'Realtek PCIe GBE Family Controller'

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
#
# Share ruby repository directories
config.vm.synced_folder '.',
                        '/home/vagrant/apps',
                        nfs: true,
                        mount_options: [
                          'nfsvers=3',
                          'vers=3',
                          'actimeo=1',
                          'rsize=8192',
                          'wsize=8192',
                          'timeo=14',
                          :nolock,
                          :udp,
                          :intr,
                          :user,
                          :auto,
                          :exec,
                          :rw
                        ]

最终的问题是这些事实中的任何一个都不能很好地与另一个配合:

1) haneWIN 的导出不能使用正斜杠,这是 winnfsd 使用的
2) winnfsd 总是把盘符放在指定路径的前面(大概是因为它正在检查本地文件系统上是否存在该路径)