Speeding up Homestead on Windows Using NFS

Sep 07 2015

Homestead Laravel

EDIT: I have another article on using Homestead with sFTP and Sublime which may be a better option for some.

I recently took the plunge into getting a Homestead vagrant box setup locally for development. I followed the instructions on the Laravel docs page and all went well. It took me only about ten minutes to get everything working within Homestead, awesome!

But wait, why is everything so slow? I started searching Google and it seems it's a common problem for Windows. It seems the trick is to enable nfs support for windows and boot your folders using the nfs file system.

It took a bit of searching and tinkering so thought I would share the few simple steps it takes to enable nfs for vagrant on Windows.

Install NFS Plugin

Just run this install for the plugin from anywhere.

vagrant plugin install vagrant-winnfsd

Update homestead.rb

There is some weird bug here, not sure why it hasn't been pushed into the main repo yet, but you will need to replace some code here (if not already live).

homestead/scripts/homestead.rb

Replace the following:

if settings.include? 'folders'
settings["folders"].each do |folder|
mount_opts = [] if (folder["type"] == "nfs")
mount_opts = folder["mount_opts"] ? folder["mount_opts"] : ['actimeo=1']
end config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
end
end

With this:

if settings.include? 'folders'
settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length } settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
end
end

Update Homestead.yaml

We can now use nfs in the folders section of the homestead config file.

folders:
- map: ~\projects
to: /home/vagrant/Code
type: nfs

Rebooting

You may also need a reboot at this point especially if you've been playing around to try and get this working.

First make sure you remove any vm in your VirtualBox and also check the ~\VritualBox VMs folder to make sure everything is deleted.

After a reboot try vagrant up again and it should spin up a new box. I found when I added folders I had to go through this each time. Fortunately that doesn't happen often at all.

Disable Sendfile

This is on a bit of a side note, but it's also recommended that sendfile for Nginx be disabled.

> sudo vi /etc/nginx/nginx.conf

And change sendfile from on to off.

Speeding up Homestead on Windows Using NFS的更多相关文章

  1. How to setup Laravel Homestead in Windows

    How to setup Laravel Homestead in Windows by JBorbón  17. March 2017   PHP   8 Developing with PHP u ...

  2. Windows挂载NFS共享盘

    Centos7添加NFS方法请见如下链接: https://www.cnblogs.com/jackyzm/p/10285845.html 一:添加NFS服务 1.1:此电脑-右键-管理-window ...

  3. CentOS挂Windows的NFS备忘

    Windows NFS 安装和配置  注:需要将名称为“所有计算机”的访问类型改为“无访问权限”,再将可访问IP的访问类型改为“读写”,并勾选“允许根目录访问” ,如WINDOWS有防火墙开放“204 ...

  4. 解决windows 挂载 nfs 驱动器中 中文乱码问题

    乱码问题,是由于 mount.nfs 命令不支持 utf-8字符集.所以是系统软件支持的问题.在网络上找了很多方案都没能解决. 网上主要有三种方案(1)换解决方案,使用smb 共享,这等于不是解决方法 ...

  5. Windows挂载NFS目录权限问题

    windows挂载Linux上的NFS后, 可能会出现没有权限打开文件的问题   解决方法: 在注册表中添加匿名用户的默认UID和GID   计算机\HKEY_LOCAL_MACHINE\SOFTWA ...

  6. Windows Mount NFS Share from e.g. Linux

    Note: Not Stable, so steps below are for reference only ************ Linux Configuration NFS Share 1 ...

  7. Windows下NFS服务器SFU设置(可以共享linux系统)

    一.安装SFU1.下载软件SFU http://download.microsoft.com/download/a/1/c/a1ca7af1-a6e3-46e7-874a-4c5d8c0fb3b7/S ...

  8. windows挂载nfs

    注意:Win10 Creators Update前只有Win10企业版可以挂载NFS, Creators Update后专业版也可挂载NFS了. 安装 按Win+R输入OptionalFeatures ...

  9. Homestead can not mount nfs on macos catalina

    It's not a vagrant issue but nfsd/macos issue.If you add to /etc/exports line:/Users/USERNAME/Docume ...

随机推荐

  1. 20180129周一之学习PYTHON笔记【安装、查看工作目录、】

    一,安装过程中多选一个ADD的项,免去设置环境变量. 二,PYAUTOGUI模块控制键鼠. IMAGE模块. ----------------------python 如何查看与更换工作目录----- ...

  2. 详解Tomcat配置及使用

    2018年06月27日 23:42:34 尘埃丶落定 阅读数:2351    版权声明:本文为博主原创文章,转载请附上作者与出处. https://blog.csdn.net/longyin0528/ ...

  3. 11-11SQLserver基础--数据库之触发器

    触发器 意义:本质上就是一个特殊的存储过程,只不过不是通过exec来调用执行,而是通过增删改数据库中的操作来执行. 作用:1.将关联的表之间的数据增删改        2.触发器可以操作视图,在视图上 ...

  4. 关闭IPV6

    [root@bgw-t ~]# cat > /etc/modprobe.d/ipv6.conf << EOF alias net-pf-10 off options ipv6 dis ...

  5. [转] #ifndef#define#endif的用法(整理) 原作者:icwk

    文件中的#ifndef 头件的中的#ifndef,这是一个很关键的东西.比如你有两个C文件,这两个C文件都include了同一个头文件.而编译时,这两个C文件要一同编译成一个可运行文件,于是问题来了, ...

  6. jstl fmt

    1)导入jstl 包,加载ftm标签 首先将jstl的jar包放入类库中,使用1.2版本 其次在jsp文件中引入所需要的 标记库,对于 ftm 标签,如下: <%@ taglib prefix= ...

  7. avalon做的抽奖效果

    .sweepstake { color: orange; font-size: 24px; font-weight: bold; } 先来一个简单的 <style> .sweepstake ...

  8. Imageen 图像切割 (JpegLosslessTrans)

    procedure CutAFile(FileName: string; qry: TQuery);var  i: Cardinal;  FromStream, ToStream: TMemorySt ...

  9. Linux初学时的一些常用命令(2)

    文件的操作   创建一个文件    touch 文件名  创建一个空白的文件 复制文件    cp 文件 目录/文件名     例如:      cp 1.txt 2.txt      cp 1.tx ...

  10. mysql允许远程登录

    Mysql为了安全性,在默认情况下用户只允许在本地登录,可是在有此情况下,还是需要使用用户进行远程连接,因此为了使其可以远程需要进行如下操作: 一.允许root用户在任何地方进行远程登录,并具有所有库 ...