MAC开启 NFS 文件系统提升 Vagrant 共享目录的性能


首先要把虚拟机的网络设置成 :private_network 模式。


centos 5 :

yum -y install nfs-utils portmap

centos 6 :

yum -y install nfs-utils rpcbind

2、MAC OS已经集成nfs,只需要修改/etc/eprots文件,如果没有则新建

sudo vi /etc/exports   保持空文件即可


config.vm.synced_folder ".", "/vagrant", type: “nfs"

保存后,使用命令 vagrant reload 重启虚拟机后才会生效,期间会修改MAC OX的 /etc/exports 文件。会提示输入mac账号的密码。输入即可!


        NFS synced folders have a set of options that can be specified that are unique to NFS. These are listed below. These options can be specified in the final part of theconfig.vm.synced_folder definition, along with the type option.

  • nfs_export (boolean) – If this is false, then Vagrant won’t modify your /etc/exportsautomatically and assumes you’ve done so already.
  • nfs_udp (boolean) – Whether or not to use UDP as the transport. UDP is faster but has some limitations (see the NFS documentation for more details). This defaults to true.
  • nfs_version (string | integer) – The NFS protocol version to use when mounting the folder on the guest. This defaults to 3.

可以设置 nfs_export的属性为true即可忽略文件的修改,会假设已经把文件设置好。