简体   繁体   English

无法在Linux主机上的Windows主机上使用Vagrant创建SMB共享文件夹

[英]Failing to create SMB shared folder using Vagrant on Windows host with linux guest

I'm using Vagrant to create an Ubuntu 14.04 guest on my Windows 7 SP 1 PC. 我正在使用Vagrant在Windows 7 SP 1 PC上创建Ubuntu 14.04 guest虚拟机。 This has been working ok, but the performance of the guest is poor when accessing files that have been synchronized from the host. 这一直可以,但是在访问从主机同步的文件时,来宾的性能很差。 After doing some reading, I'm trying to make the synchronized folder an SMB share, however this is failing when I run 'vagrant up' 阅读后,我试图使同步文件夹成为SMB共享,​​但是当我运行“ vagrant up”时失败了

Note that I've upgraded to powershell 3.0, as documented in https://docs.vagrantup.com/v2/synced-folders/smb.html . 请注意,如https://docs.vagrantup.com/v2/synced-folders/smb.html中所述 ,我已升级到Powershell 3.0。 I've also ensured that my guest has cifs-util installed as pointed out in https://github.com/mitchellh/vagrant/issues/4642 . 我还确保我的来宾已按照https://github.com/mitchellh/vagrant/issues/4642中的指示安装了cifs-util。 I'm using Vagrant 1.7.4 and VirtualBox 4.3.28 我正在使用Vagrant 1.7.4和VirtualBox 4.3.28

My Vagrantfile looks like this: 我的Vagrantfile看起来像这样:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "npt"

  config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
    v.customize ["modifyvm", :id, "--memory", "4096"]
    v.customize ["modifyvm", :id, "--cpus", 2]
  end

  config.vm.synced_folder "\\", "/npt_root", type: "smb"

  config.vm.provision :shell do |shell|
    shell.inline = "puppet module install puppetlabs/vcsrepo --force"
  end

  config.vm.provision "puppet" do |puppet|
    puppet.manifests_path = "puppet"
    puppet.manifest_file  = "basic_build_reqs.pp"
  end

  config.ssh.username = 'root'
  config.ssh.password = 'vagrant'
  config.ssh.insert_key = 'true'

end

And the output I am seeing is: 我看到的输出是:

Z:\npt\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'npt'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant_default_1442502969737_66801
==> default: Preparing SMB shared folders...
    default: You will be asked for the username and password to use for the SMB
    default: folders shortly. Please use the proper username/password of your
    default: Windows account.
    default:
    default: Username: tdj@DCL
    default: Password (will be hidden):
Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.

Host path: Z:/

Stderr: System error 123 has occurred.

The filename, directory name, or volume label syntax is incorrect.

Error:


Stdout:

It looks like Vagrant has interpreted the relative path "\\" I've given it and is coming up with "Z:/", with unix style slashes, which Windows is then failing to parse. 好像Vagrant解释了我给它的相对路径“ \\”,并提出了“ Z:/”,并带有unix样式斜杠,Windows无法解析该斜杠。

Note that I've tried replacing the relative path with the absolute path "Z:\\", but I still see the same output on the "Host path" line 请注意,我尝试用绝对路径“ Z:\\”替换相对路径,但在“主机路径”行上仍然看到相同的输出

I suspect "\\\\" is the problem in the following line: 我怀疑“ \\\\”是以下行中的问题:

config.vm.synced_folder "\\\\", "/npt_root", type: "smb" config.vm.synced_folder“ \\\\”,“ / npt_root”,键入:“ smb”

Could you try to put in a concrete foldername that you would like to share with your VM and test if it works? 您能否尝试输入要与VM共享的具体文件夹名称并测试其是否有效?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无业游民:Windows主机和Windows来宾-如何限制SMB共享? - Vagrant: Windows host and Windows guest - how to restrict smb share? Vagrant-无法使用Puphpet和SMB挂载在Linux Guest中挂载文件夹 - Vagrant - Failed to mount folders in Linux Guest using Puphpet and SMB mounting Windows 10 Pro 和 Hyper-V 上的 Vagrant SMB 共享文件夹上的“一般访问被拒绝错误” - Vagrant on Windows 10 Pro and Hyper-V "General access denied error" on SMB shared folder vagrant:在主机和来宾之间共享ssh文件夹 - vagrant: Share ssh folder between host and guest 使用Windows主机上的Vagrant在git克隆到共享文件夹后直接更改文件 - Files changed directly after git clone into shared folder using Vagrant on windows host Vagrant 从主机(windows)访问来宾机器 - Vagrant access guest machine from host (windows) Vagrant over Hyper-V 慢速共享文件夹 SMB - Vagrant over Hyper-V slow shared folder SMB Vagrant无法通过Windows 7上的VirtualBox Guest Additions在Linux guest虚拟机中挂载 - Vagrant unable to mount in Linux guest with VirtualBox Guest Additions on Windows 7 Vagrant-Azure:来宾机器无法连接到主机(无法复制 SMB 文件) - Vagrant-Azure: Guest machine can't connect to host machine (Unable to copy SMB files) Vagrant:如何将文件夹从访客同步回主机? - Vagrant: How to sync folder from guest back to host?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM