Trellis on Windows w/ NFS - keeps mounting old shared folders

This is probably more of a “WinNFSD.exe” question than a Trellis-specific question, but it seems to have started only after I began using Trellis. I was trying to setup a new Laravel Homestead box, and nfs failed to run.

I’ve managed to make the necessary changes to Homestead’s homestead.rb file (which is included in it’s Vagrantfile), so it works, but I’ve noticed something strange about the way (I believe) Trellis is handling these shared folders.

I’ve setup a couple different trellis sites, but at this point I am only working on one. However, any time I boot up a vagrant box with “vagrant up”, nfs is mounting all of the old shared folders from basically any vagrant box I’ve ever brought online that was configured to use nfs for shared folders.

There appears to be a cache, or a global configuration for vagrant/virtualbox/winnfsd which is saving these shared folder maps. It doesn’t make much sense to me, as I would assume it would be using a clean config each time and just mounting the shared folders listed there.

And I’m not sure if this is the source of my problems with Homestead, but it seems to be, as Homestead worked fine when it was the only nfs share to mount.

Again, most likely not specifically a “Trellis” issue, but given the number of people here who may be using Trellis on Windows with NFS for shared folders, I figured maybe someone has seen this before and might have a solution.

TL;DR: NFS is saving old shared folder mappings and is mapping all of them when I run “vagrant up”, not just the ones defined in the current vagrantfile / wordpress-sites.yml config.

Vagrant 1.8.x has compatibility issues with WinNFSD, as noted in the vagrant-winnfsd repo. So if you’re on Vagrant 1.8.x, that could be the source of your problem.

I did take a quick look at the sauce, and it looks like Vagrant core says that Windows isn’t capable of NFS (cf. BSD actually has logic to determine whether it’s supported). That’s probably why it’s defaulting to a normal shared folder. You can use vagrant-winnfsd, but as noted above, there appear to be some compatibility issues.

Like I said, it was just a quick look. There might be other ways of telling Vagrant that a Windows host can handle NFS, I don’t know. But this might be enough info for you to figure out what’s going on.

I don’t think we’re doing anything particularly different from anyone else as far as shared folders go. If you do discover that this is an issue with Trellis, you’re more than welcome to submit a PR or at least point out where we’re doing things differently.

1 Like

Thx for taking a look at this. I’m currently using NFS, and I believe it’s vagrant-winnfsd (it’s installed, at least), so it’s “working” fine. What I ended up doing to get things working was basically to copy the stuff from the Vagrantfile on Trellis and use it to replace the folder sharing part of the code on Homestead which was at /vendors/laravel/homestead/Homestead.rb, I believe.

What I still haven’t been able to find is the storage location for NFS’s shared folder config. It’s caching or saving the shared folder configs somewhere and reloading them from a “master” file regardless of which vagrant file or vagrant folder or box or whatever you use.

So it’s being saved somewhere, probably somewhere in WinNFSD’s storage locations (like the folder on your hard drive where it stores its config files), but I haven’t been able to find it.