dustymabe/vagrant-sshfs

[RFE] Evaluate use case of mounting folder from guest to the host

dustymabe opened this issue · 13 comments

In the previous version of vagrant-sshfs a user could mount a folder from the guest into the host. Let's evaluate the use cases for this to determine if there are valid alternatives or if it is necessary to add the "mount guest folder onto host" functionality again.

Traditionally vagrant has been a throw away environment so mounting files from the guest into the host doesn't seem to be valuable because the files will be destroyed when the box is destroyed.

One such benefit of the "mount guest folder onto host" is that the files actually live inside the guest and thus accessing the files are "local accesses" within the guest, which means performance could be better if disk intensive activities are occurring inside the guest.

Let's discuss this and evaluate alternatives before we decide to, or not too, include support for this.

tisba commented

In fabiokr/vagrant-sshfs#40 (comment) I already described the issue for us.

We have a setup, where we require decent file system performance for the applications that run in vagrant guest. The only viable solution we found to be working, was to have the host mounting a volume from the guest, so that the guest can work locally on the files.

I'm totally +1 on the issue, that you have to be careful when destroying (e.g. for updating) the box, because you will potentially lose something. I'd love to be able to avoid that as well, but this was not really a viable option because.

We need this functionality as well, and I was quite surprised to find it removed. Our use case is that we don't actually use /vagrant for our code, because the mounting is so slow that trying to run commands that touch lots of files (like git or find or recursive greps) can take minutes instead of seconds. So instead of using vboxsf to mount code in /vagrant from host-to-guest, we git clone the repo into a local directory on the Vagrant box and use sshfs to mount it guest-to-host. This has really solved a lot of our problems, so I would hate to see it gone permanently.

I was able to use the workaround in fabiokr/vagrant-sshfs#40 (i.e. installing the older version) as a temporary fix:

vagrant plugin install vagrant-sshfs --plugin-version 0.0.8

Hey @barefootcoder. thanks for the feedback. Please do continue to use version 0.0.8 of the plugin for now. I'm going to try to either find a suitable alternative for this use case or add this back as a supported mode to vagrant-sshfs.

We at DoSomething.org also rely on this functionality. Here's our wiki page on how we use guest-to-host mounts:
https://github.com/DoSomething/phoenix/wiki/Building-your-local-environment-(SSHFS)

Hi @sergii-tkachenko.. Thanks for your feedback on this. It's good to know how many people are using it this way.

Like @barefootcoder, I also use this approach due to a performance hit while working on a large project with thousands of tests. The guest-to-host mount has been the best option so far. Using the standard host-to-guest mount approach causes a huge increase in test times.

Note that I keep my project configs on a host-to-guest mount (symlinked inside the box to the appropriate projects).
This provides the benefits of performance without the cons of losing config files when the box is destroyed.

Very keen to see this back in the plugin, have downgraded as per @barefootcoder's example until then.

@adamelliottsweeting thanks. I do believe that I will add this back to the plugin. Trying to find time to do this. Hopefully won't be too long.

Hello @tisba @barefootcoder @sergii-tkachenko @adamelliottsweeting. The code for this has been merged. Would you please test out the latest pre-release to see if it works for you?

here is how to test:

vagrant plugin uninstall vagrant-sshfs
wget https://dustymabe.fedorapeople.org/gem/vagrant-sshfs-1.1.0.dev.gem
vagrant plugin install ./vagrant-sshfs-1.1.0.dev.gem
tisba commented

Thats great, thanks @dustymabe!

In the meantime we completely switched away from using sshfs and we are now on NFS again which works kind of okay after some tuning. I'd like to give the dev release a test, but I cannot promise to do that soonish :-/

@tisba hopefully we can win you back over

ravn commented

We have another situation where we want to be able to easily see local files inside the guest to get the full benefit of the development environment in which vagrant runs. We do not have to edit the files. Previously we have used a shared host folder, but this mean that files run out of sync if the VM is rolled back to a snapshot (which we use a lot).

@ravn - we support this in the latest release. give it a try

I'm using it for have access from the host to the logs generated on the Vagrant guest machine
Very useful during development and debugging