我正在使用Vagrant在Windows 7 SP 1 PC上創建Ubuntu 14.04訪客。這一直工作正常,但訪問從主機同步的文件時,guest虛擬機的性能很差。在做了一些閱讀後,我試圖讓同步文件夾成爲SMB共享,但是當我運行'vagrant up'時,這是失敗的。未能在Windows客戶機上使用Vagrant在Linux客戶機上創建SMB共享文件夾
請注意,我已升級到PowerShell 3.0,如https://docs.vagrantup.com/v2/synced-folders/smb.html中所述。我還確保我的客人安裝了cifs-util,正如https://github.com/mitchellh/vagrant/issues/4642中指出的那樣。我使用的是流浪1.7.4和VirtualBox的28年3月4日
我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
而且我看到的輸出是:
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: [email protected]
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:
它看起來像流浪漢有解釋了我給出的相對路徑「\」,並提供了「Z:/」,帶有unix風格的斜槓,而Windows無法解析。
請注意,我已經嘗試使用絕對路徑「Z:\」代替相對路徑,但我還是看到了「主路徑」行