mitchellh/vagrant — pull request #3076 by p0deje (2014-03-07 14:06:59+00:00)
Title: NFS: Use exportfs instead of /etc/exports on Linux

Re-opened (after fixes and updates) #1695, which was closed due to misunderstanding.

Basically, this makes only one change - `exportfs` cli tool is used to export/unexport NFS filesystems. It is better because:

1. Current implementation (which echoes exports to `/etc/exports` file) does not scale well. Specifically, I've been getting collisions in exports file with parallel startup of 10 Vagrant boxes (i.e. when 10 Vagrant processes start echoing to file, it becomes a mess).
2. It does not pollute `/etc/exports` file, which may be used by user for real persistent exports.
3. Each export/unexport operations has no effect on other active exports. Currently, if user used `exportfs` cli tool to temporarily export NFS filesystem, it will be removed with `vagrant up` (as it cares only about records in `/etc/exports`)

`exportfs` is available on Linux, so we can use it there. It's 100% unavailable on OS X. I am not sure about *BSD systems.

This is how it looks now:

vagrant up

![screen shot 2014-03-07 at 20 40 36](https://f.cloud.github.com/assets/665846/2357533/0543068a-a600-11e3-8cbe-5f5e9ba364ea.png)

vagrant destroy

![screen shot 2014-03-07 at 20 40 46](https://f.cloud.github.com/assets/665846/2357536/0e77c506-a600-11e3-8247-70a66c223909.png)

With this patch, I was able to successfully use Vagrant for parallel running of 10 KVM instances in our CI. It may also be the fix for #1585