让Vagrant在Windwos下支持使用NFS/SMB共享文件夹从而解决目录共享IO缓慢的问题
此问题是在拥有相同配置的环境中,项目在win10跑的慢而在win7就正常的情况下发现的,一步步调试之后发现是文件操作的相关行为变的很慢,于是考虑到可能是系统问题,后来在如下链接找到了解决办法:http://www.iamle.com/archives/2011.html
1。nfs方式
安装vagrant 插件 vagrant-winnfsd
$ vagrant plugin install vagrant-winnfsd
但是这样安装会出现以下错误
Installing the 'vagrant-winnfsd' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is: An error occurred while installing childprocess (0.5.), and Bundler cannot continue.
Make sure that `gem install childprocess -v '0.5.8'` succeeds before bundling. Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Gem::RemoteFetcher::FetchError: Errno::ECONNABORTED: An established connection was aborted by the software in your host machine. - SSL_connect (https://rubygems.org/gems/childprocess-0.5.8.gem)
看来是缺少childprocess-0.5.8.gem这个东西
索性把需要的包都下载到本地,然后本地安装
https://rubygems.org/gems/childprocess-0.5.8.gem
https://rubygems.org/gems/vagrant-winnfsd-1.1.0.gem
然后
vagrant plugin install childprocess-0.5..gem
vagrant plugin install vagrant-winnfsd-1.1..gem
看一看安装好的插件
$ vagrant plugin list
childprocess (0.5.)
- Version Constraint: 0.5.
vagrant-share (1.1., system)
vagrant-winnfsd (1.1.)
- Version Constraint: 1.1.
编辑项目下的Vagrantfile文件
Vagrant.configure('') do |config|
# other config here
config.vm.network "private_network", ip: "192.168.33.10"
#winfsd
config.winnfsd.logging = "on"
config.winnfsd.uid =
config.winnfsd.gid =
config.vm.synced_folder "./", "/vagrant", type: "nfs"
end
2.SMB方式
Vagrant.configure('') do |config|
# other config here
config.vm.network "private_network", ip: "192.168.33.10"
#SMB
config.vm.synced_folder "./", "/vagrant", type: "smb",
smb_username: "母鸡Windows帐号",
smb_password: "母鸡Windows密码",
owner: "www",
group: "www"
#mount_options: ["dmode=775,fmode=664"]
end
启动vagrant虚拟机, 注意启动过程当中需要输入windwos系统的帐号和密码
d:\projects>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Fixed port collision for => . Now on port .
==> 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: administrator
default: Password (will be hidden):
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter : nat
default: Adapter : hostonly
==> default: Forwarding ports...
default: => (adapter )
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.
default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting SMB shared folders...
default: D:/projects => /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run. d:\projects>
发现vagrant开启了一个名称为c30268623ba3dedeaa9f098b570dca21的共享
这个地方有个安全大坑,共享权限居然是Everyone!所以注意母鸡Windows上是否有其他帐号能访问!
我把c30268623ba3dedeaa9f098b570dca21本共享的权限改了,发现vagrant还是会把权限设置为Everyone
如果有开启其他普通帐号,guest什么的这里有安全隐患
C:\Users\Administrator>net share 共享名 资源 注解 -------------------------------------------------------------------------------
IPC$ 远程 IPC
c30268623ba3dedeaa9f098b570dca21
D:\projects
命令成功完成。
为了防止smb共享剔除不活动的连接需要执行以下命令让系统不要自动踢掉不活动的连接
net config server /autodisconnect:-1
vagrant不会自动删除共享,要删除共享使用命令
net share c30268623ba3dedeaa9f098b570dca21 /delete
让Vagrant在Windwos下支持使用NFS/SMB共享文件夹从而解决目录共享IO缓慢的问题的更多相关文章
- VMware下 Ubuntu 看不到共享文件夹之解决办法
VMware下 Ubuntu 看不到共享文件夹之解决办法 初学Linux,在VMWare 上装了Ubuntu10.04,主机端和虚拟机相互间的访问是必不可少的,途径有许多,其中vmware tool提 ...
- Virtualbox下Ubuntu与主机Win7共享文件夹
记下来,免得老google. 1. 在虚拟机设置里设置好win7的共享文件夹位置:如c:\share 2.确定ubuntu下需要共享的文件夹,如~/linuxshare.注意,此文件夹名字必须与win ...
- 在Ubuntu主机下实现与Windows虚拟机共享文件夹
一.概述 由于要实现Ubuntu主机中的一些文件与Windows虚拟机共享,因此要创建一个共享文件夹映射到虚拟机中. 网上许多都是Windows主机+Linux虚拟机的配置,在此分享主机是Linux的 ...
- NFS挂载共享文件夹
修改rcS启动脚本,使开发板初始化完成,自动挂载共享文件夹 修改开发板ip,使之与虚拟机处于同一网段(二者可以互ping) 挂载虚拟机的共享文件夹 rcS 1 ifconfig eth ...
- C# 拷贝指定文件夹下的所有文件及其文件夹到指定目录
要拷贝的文件及其文件夹结构 其中.lab文件不能覆盖 /// <summary> /// 拷贝oldlab的文件到newlab下面 /// </summary> /// < ...
- VMware下Ubuntu与宿主Windows共享文件夹
概述1.安装VMware Tool2.设置共享 步骤开始安装VMware Tool 显示如下画面(如果宿主无法访问外网,可能会出现一个更新失败,可以无视之) 通过下列命令解压.执行,分别是下面的tar ...
- VMware下Ubuntu与宿主Windows共享文件夹 (转至 http://blog.csdn.net/zz962/article/details/7706755)
概述 1.安装VMware Tool 2.设置共享 步骤 开始安装VMware Tool 显示如下画面(如果宿主无法访问外网,可能会出现一个更新失败,可以无视之) 通过下列命令解压.执行,分别是下面的 ...
- 定时自动同步文件,支持多文件夹同步,支持过滤文件和文件夹,解决FileSystemWatcher多次文件触发事件(源码)
博客园里面有很多同步工具和软件,关于FileSystemWatcher类解释的也很多,但收集了很多文章后,感觉没好的方法,自己没事写了一个定时文件同步,借鉴了很多博客园朋友的东西: 上主菜: 配置文件 ...
- mac下VirtualBox跟linux虚拟机共享文件夹
1.在VirtualBox中设置好共享目录,设置自动挂载/固定分配 2.安装增强工具,为了避免安装出错需要安装依赖文件 #更新内核. yum update kernel#需要安装相应的kernel-d ...
随机推荐
- MATLAB——文件读写(1)
1.文件打开关闭 (1)文件打开 fid=fopen(文件名,‘打开方式’)说明:其中fid用于存储文件句柄值,如果返回的句柄值大于0,则说明文件打开成功.文件名用字符串形式,表示待打开的数据文件.常 ...
- I、恋爱之子
链接:https://ac.nowcoder.com/acm/contest/3570/I 来源:牛客网 题目描述 最近ZSC和他的女朋友NULL吵架了.因为ZSC是一个直男,他不知道该怎么办,于是他 ...
- python中的两个高阶函数map()和reduce()
1.map()传入的有两个参数,函数和可迭代对象(Itreable),map()是把传入的函数依次作用于序列的每个元素,结果返回的是一个新的可迭代对象(Iterable). map()代码如下: # ...
- js之ES6的Class类
JavaScript ES6之前的还没有Class类的概念,生成实例对象的传统方法是通过构造函数. 例如: function Mold(a,b){ this.a=a; this.b=b; } Mold ...
- 配置NTP和crontab计划任务
配置NTP网络时间客户端和设置计划任务 3.1问题 本例要求配置虚拟机server0,能够自动校对系统时间.相关信息如下: NTP服务器 ...
- Shell:Day08.笔记
函数:写一个代码块,用来重复调用的: 1.函数的写法格式 2.参数,在函数名后面直接加,即可:如果在外面 abc(){ 函数体 $@ } abc 1 2 3 4 5 :wq a.s ...
- SpringMVC(五):JSON
本文是按照狂神说的教学视频学习的笔记,强力推荐,教学深入浅出一遍就懂!b站搜索狂神说或点击下面链接 https://space.bilibili.com/95256449?spm_id_from=33 ...
- 薅羊毛? 月入10万? | 这是自动化测试老司机的特长--Python自动化带你薅视频红包,一个都不放过!
一.目标场景 如今短视频横行的时代,以某短视频为首的,背后依靠着强大的资金后盾,疯狂地对平台用户进行红包轰炸. 与传统的红包不一样,视频红包包含位置的不确定性.大小不确定性.元素 ID 的不确定性 ...
- 尝试用tornado部署django
import os from tornado.options import options, define from tornado import httpserver from tornado.io ...
- 7.1 java 类、(成员)变量、(成员)方法
/* * 面向对象思想: * 面向对象是基于面向过程的编程思想. * * 面向过程:强调的是每一个功能的步骤 * 面向对象:强调的是对象,然后由对象去调用功能 * * 面向对象的思想特点: * A:是 ...