此问题是在拥有相同配置的环境中,项目在win10跑的慢而在win7就正常的情况下发现的,一步步调试之后发现是文件操作的相关行为变的很慢,于是考虑到可能是系统问题,后来在如下链接找到了解决办法:http://www.iamle.com/archives/2011.html

1。nfs方式

安装vagrant 插件 vagrant-winnfsd

$ vagrant plugin install vagrant-winnfsd

但是这样安装会出现以下错误

  1. Installing the 'vagrant-winnfsd' plugin. This can take a few minutes...
  2. Bundler, the underlying system Vagrant uses to install plugins,
  3. reported an error. The error is shown below. These errors are usually
  4. caused by misconfigured plugin installations or transient network
  5. issues. The error from Bundler is:
  6.  
  7. An error occurred while installing childprocess (0.5.), and Bundler cannot continue.
  8. Make sure that `gem install childprocess -v '0.5.8'` succeeds before bundling.
  9.  
  10. 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
然后

  1. vagrant plugin install childprocess-0.5..gem
  2. vagrant plugin install vagrant-winnfsd-1.1..gem

看一看安装好的插件

  1. $ vagrant plugin list
  2. childprocess (0.5.)
  3. - Version Constraint: 0.5.
  4. vagrant-share (1.1., system)
  5. vagrant-winnfsd (1.1.)
  6. - Version Constraint: 1.1.

编辑项目下的Vagrantfile文件

  1. Vagrant.configure('') do |config|
  2. # other config here
  3. config.vm.network "private_network", ip: "192.168.33.10"
  4.  
  5. #winfsd
  6. config.winnfsd.logging = "on"
  7. config.winnfsd.uid =
  8. config.winnfsd.gid =
  9. config.vm.synced_folder "./", "/vagrant", type: "nfs"
  10. end

2.SMB方式

  1. Vagrant.configure('') do |config|
  2. # other config here
  3. config.vm.network "private_network", ip: "192.168.33.10"
  4.  
  5. #SMB
  6. config.vm.synced_folder "./", "/vagrant", type: "smb",
  7. smb_username: "母鸡Windows帐号",
  8. smb_password: "母鸡Windows密码",
  9. owner: "www",
  10. group: "www"
  11. #mount_options: ["dmode=775,fmode=664"]
  12. end

启动vagrant虚拟机, 注意启动过程当中需要输入windwos系统的帐号和密码

  1. d:\projects>vagrant up
  2. Bringing machine 'default' up with 'virtualbox' provider...
  3. ==> default: Fixed port collision for => . Now on port .
  4. ==> default: Preparing SMB shared folders...
  5. default: You will be asked for the username and password to use for the SMB
  6. default: folders shortly. Please use the proper username/password of your
  7. default: Windows account.
  8. default:
  9. default: Username: administrator
  10. default: Password (will be hidden):
  11. ==> default: Clearing any previously set network interfaces...
  12. ==> default: Preparing network interfaces based on configuration...
  13. default: Adapter : nat
  14. default: Adapter : hostonly
  15. ==> default: Forwarding ports...
  16. default: => (adapter )
  17. ==> default: Booting VM...
  18. ==> default: Waiting for machine to boot. This may take a few minutes...
  19. default: SSH address: 127.0.0.1:
  20. default: SSH username: vagrant
  21. default: SSH auth method: private key
  22. default: Warning: Connection timeout. Retrying...
  23. default: Warning: Connection timeout. Retrying...
  24. default: Warning: Remote connection disconnect. Retrying...
  25. ==> default: Machine booted and ready!
  26. ==> default: Checking for guest additions in VM...
  27. default: The guest additions on this VM do not match the installed version of
  28. default: VirtualBox! In most cases this is fine, but in rare cases it can
  29. default: prevent things such as shared folders from working properly. If you see
  30. default: shared folder errors, please make sure the guest additions within the
  31. default: virtual machine match the version of VirtualBox you have installed on
  32. default: your host and reload your VM.
  33. default:
  34. default: Guest Additions Version: 4.3.
  35. default: VirtualBox Version: 5.0
  36. ==> default: Configuring and enabling network interfaces...
  37. ==> default: Mounting SMB shared folders...
  38. default: D:/projects => /vagrant
  39. ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
  40. ==> default: flag to force provisioning. Provisioners marked to run always will still run.
  41.  
  42. d:\projects>

发现vagrant开启了一个名称为c30268623ba3dedeaa9f098b570dca21的共享
这个地方有个安全大坑,共享权限居然是Everyone!所以注意母鸡Windows上是否有其他帐号能访问!
我把c30268623ba3dedeaa9f098b570dca21本共享的权限改了,发现vagrant还是会把权限设置为Everyone
如果有开启其他普通帐号,guest什么的这里有安全隐患

  1. C:\Users\Administrator>net share
  2.  
  3. 共享名 资源 注解
  4.  
  5. -------------------------------------------------------------------------------
  6. IPC$ 远程 IPC
  7. c30268623ba3dedeaa9f098b570dca21
  8. D:\projects
  9. 命令成功完成。

为了防止smb共享剔除不活动的连接需要执行以下命令让系统不要自动踢掉不活动的连接
net config server /autodisconnect:-1

vagrant不会自动删除共享,要删除共享使用命令
net share c30268623ba3dedeaa9f098b570dca21 /delete

让Vagrant在Windwos下支持使用NFS/SMB共享文件夹从而解决目录共享IO缓慢的问题的更多相关文章

  1. VMware下 Ubuntu 看不到共享文件夹之解决办法

    VMware下 Ubuntu 看不到共享文件夹之解决办法 初学Linux,在VMWare 上装了Ubuntu10.04,主机端和虚拟机相互间的访问是必不可少的,途径有许多,其中vmware tool提 ...

  2. Virtualbox下Ubuntu与主机Win7共享文件夹

    记下来,免得老google. 1. 在虚拟机设置里设置好win7的共享文件夹位置:如c:\share 2.确定ubuntu下需要共享的文件夹,如~/linuxshare.注意,此文件夹名字必须与win ...

  3. 在Ubuntu主机下实现与Windows虚拟机共享文件夹

    一.概述 由于要实现Ubuntu主机中的一些文件与Windows虚拟机共享,因此要创建一个共享文件夹映射到虚拟机中. 网上许多都是Windows主机+Linux虚拟机的配置,在此分享主机是Linux的 ...

  4. NFS挂载共享文件夹

    修改rcS启动脚本,使开发板初始化完成,自动挂载共享文件夹 修改开发板ip,使之与虚拟机处于同一网段(二者可以互ping)     挂载虚拟机的共享文件夹     rcS 1 ifconfig eth ...

  5. C# 拷贝指定文件夹下的所有文件及其文件夹到指定目录

    要拷贝的文件及其文件夹结构 其中.lab文件不能覆盖 /// <summary> /// 拷贝oldlab的文件到newlab下面 /// </summary> /// < ...

  6. VMware下Ubuntu与宿主Windows共享文件夹

    概述1.安装VMware Tool2.设置共享 步骤开始安装VMware Tool 显示如下画面(如果宿主无法访问外网,可能会出现一个更新失败,可以无视之) 通过下列命令解压.执行,分别是下面的tar ...

  7. VMware下Ubuntu与宿主Windows共享文件夹 (转至 http://blog.csdn.net/zz962/article/details/7706755)

    概述 1.安装VMware Tool 2.设置共享 步骤 开始安装VMware Tool 显示如下画面(如果宿主无法访问外网,可能会出现一个更新失败,可以无视之) 通过下列命令解压.执行,分别是下面的 ...

  8. 定时自动同步文件,支持多文件夹同步,支持过滤文件和文件夹,解决FileSystemWatcher多次文件触发事件(源码)

    博客园里面有很多同步工具和软件,关于FileSystemWatcher类解释的也很多,但收集了很多文章后,感觉没好的方法,自己没事写了一个定时文件同步,借鉴了很多博客园朋友的东西: 上主菜: 配置文件 ...

  9. mac下VirtualBox跟linux虚拟机共享文件夹

    1.在VirtualBox中设置好共享目录,设置自动挂载/固定分配 2.安装增强工具,为了避免安装出错需要安装依赖文件 #更新内核. yum update kernel#需要安装相应的kernel-d ...

随机推荐

  1. Go语言库系列之email

    导读 大家好我是平也,今天跟大家介绍一款用来发送邮件的Go语言库email,目前星星1.3k,非常好用. 极速上手 准备工作 初始化项目 go get github.com/jordan-wright ...

  2. JS事件之onmouseover 、onmouseout 与onmouseenter 、onmouseleave区别

    疫情过后回武汉的第一天打卡,今天偶然遇到一个问题onmouseover .onmouseout 与onmouseenter .onmouseleave这些事件的区别,也看了一些博客,感觉不是很清楚,所 ...

  3. CodeForces 280B(枚举 + 单调栈应用)

    题目链接 思路如下 这题恶心的枚举任意区间的 最大值及次最大值 ,正常的操作是,是很难实现的,但偏偏有个 单调栈这个动西,能够完成这个任务,跟单调队列相似,有单调 递增.递减的栈,这一题我们需要维护的 ...

  4. shell查询目标jvm的perm占比

    #查询指定进程号下面的方法区使用率,jdk1.7是perm,jdk1.8是metaspace function get_perm_use_percent() { pid="$1" ...

  5. SpringCloud Alibaba01-Nacos

    全家桶介绍: https://spring-cloud-alibaba-group.github.io/github-pages/greenwich/spring-cloud-alibaba.html ...

  6. mysql yum源安装

    部署服务器环境的时候经常要安装mysql,以下是常见的安装方式 源码安装 rpm包安装 yum源安装 这篇主要介绍yum源安装. yum源下载 进入 https://dev.mysql.com/dow ...

  7. scala_spark实践1

    /** * scala模型的main(args:Array[String])是业务执行入口 * org.apache.spark.{SparkConf, SparkContext} * val spa ...

  8. python3(二十) module

    # 在Python中,一个.py文件就称之为一个模块(Module) # 1.最大的好处是大大提高了代码的可维护性. # 2.可以被其他地方引用 # 3.python内置的模块和来自第三方的模块 # ...

  9. Python 操作mysql数据库之 SQLAlchemy 案例详解

      前言: 字段声明类型中,最右边的是数据库中对应的字段,我们依然可以使用,其左边的的 SQLAchemy 则是其自身封装的自定义类型. 本篇不会讲太多的理论知识,因为这个实用性更强,所以通篇全部都是 ...

  10. 算法竞赛 从c到c++3

    const 常指针,指向固定位置,不能再次修改指向的位置,需要初始化,const 加在“*”号后面,名称前面,例如 int *const p: 指向常量的指针,不能修改指向地址的内容,相当于常引用,c ...