Allow vagrant to use NFS/SMB shared folders under Windwos To resolve directory share IO slow issues

Source: Internet
Author: User

This problem is in the environment with the same configuration, the project in the Win10 run slowly and in the Win7 normal situation found, step by step debugging after the discovery is the file operation of the relevant behavior becomes very slow, so consider the possible system problems, and later in the following link found the solution:/http Www.iamle.com/archives/2011.html

1. NFS Mode

Installing the Vagrant plugin VAGRANT-WINNFSD

$ vagrant Plugin Install VAGRANT-WINNFSD

However, the following error will occur with this installation

Installing the'VAGRANT-WINNFSD'plugin. This can take a few minutes ... Bundler, the underlying system Vagrant uses toInstallplugins,reported an error. The error is shown below. These errors is usuallycaused by misconfigured plugin installations or transient networkissues. The error from Bundler Is:an error occurred whileInstalling Childprocess (0.5.8), and bundler cannot continue. Make sure that ' gemInstallChildprocess-v'0.5.8'' succeeds before bundling. Warning:this Gemfile contains multiple primary sources. Using ' source ' Morethan once without a block is a security risk, and may resultinchInstalling unexpected gems. To resolve the warning, use a block to indicatewhichGems should come from the secondary source. To upgrade the warning to an error, run ' bundle config Disable_multisourcetrue`. Gem::remotefetcher::fetcherror:errno::econnaborted:an established connection was aborted by the softwareinchYour host machine. -Ssl_connect (https://Rubygems.org/gems/childprocess-0.5.8.gem)

It seems to be a lack of childprocess-0.5.8.gem.
Simply download the required packages locally and install them locally.
Https://rubygems.org/gems/childprocess-0.5.8.gem
Https://rubygems.org/gems/vagrant-winnfsd-1.1.0.gem
And then

Install childprocess-0.5. 8  Install vagrant-winnfsd-1.1. 0. Gem

Take a look at the installed plug-in

$ vagrant Plugin listchildprocess (0.5. 8 )  0.5. 8 vagrant-share (1.1.  4, System) vagrant-WINNFSD (1.1.  0)  1.1. 0

Edit a Vagrantfile file under a project

Vagrant.configure ('2') Do|config|# Other config here Config.vm.network"private_network"Ip:"192.168.33.10"#winfsd config.winnfsd.logging=" on"Config.winnfsd.uid=1Config.winnfsd.gid=1Config.vm.synced_folder"./","/vagrant", type:"NFS"End

2.SMB mode

Vagrant.configure ('2') 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:"hen Windows account", Smb_password:"hen Windows password", Owner:"www", group:"www"#mount_options: ["dmode=775,fmode=664"]end

Start the vagrant virtual machine, and note that you need to enter the account number and password of the WINDWOS system during startup

D:\projects>Vagrant upbringing Machine'default'Up with'VirtualBox'provider ...==> default:fixed Port Collision for  A=2222. Now on port2200.==>default:preparing SMB Shared Folders ... default:you 'll be asked forThe username and password to use forThe SMB default:folders shortly. Use the proper username/password of your default:windows account. Default:default:Username:administrator Default:password (would be hidden):==>default:clearing Any previously set network interfaces ...==>default:preparing Network interfaces based on configuration ... default:adapter1: Nat Default:adapter2: Hostonly==>default:forwarding Ports ... default: A=2200(Adapter1)==>default:booting VM ...==> default:waiting forMachine to boot. This could take a few minutes ... default:ssh address:127.0.0.1:2200default:ssh username:vagrant default:ssh auth method:private key default:Warning:Connection timeout. R etrying. Default:Warning:Connection timeout. Retrying default:Warning:Remote connection disconnect. Retrying ...==> Default:machine booted and ready!==> default:checking forGuest Additionsinchvm ... default:the guest additions on this VM DoNot match the installed version of Default:virtualbox! In the most cases this is fine, butinchRare cases it can default:prevent things such as shared folders from working properly. If you see default:shared folder errors, please Makesure the guest additions within the Default:virtual machine match the version of the VirtualBox you had installed on    Default:your host and reload your VMS. 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'll still run.d:\projects>

Discover that vagrant opens a shared name called C30268623ba3dedeaa9f098b570dca21
This place has a security pit, sharing permissions incredibly is everyone! so pay attention to hen windows on whether there are other accounts can access!
I changed the permissions of the C30268623ba3dedeaa9f098b570dca21 share, and found that vagrant will still set the permissions to everyone
If there are other ordinary account opening, guest or something here is a security risk

C:\users\administrator>net share shared name       resource                            annotations -------------------------------------------------- -----------------------------ipc$                                         remote ipcc30268623ba3dedeaa9f098b570dca21             D:\projects command completed successfully. 

To prevent SMB sharing from rejecting inactive connections, you need to execute the following command to let the system not automatically kick off inactive connections
NET config server/autodisconnect:-1

Vagrant does not automatically delete shares, to remove shared use commands
NET share C30268623ba3dedeaa9f098b570dca21/delete

Allow vagrant to use NFS/SMB shared folders under Windwos To resolve directory share IO slow issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.