README.md in vagrant-sshfs-1.1.0 vs README.md in vagrant-sshfs-1.2.0
- old
+ new
@@ -1,12 +1,12 @@
# vagrant-sshfs
This is a vagrant plugin that adds synced folder support for mounting
folders from the Vagrant host into the Vagrant guest via
-[SSHFS](https://github.com/libfuse/sshfs). It does this by executing
-the `SSHFS` client software within the guest, which creates and SSH
-connection from the Vagrant guest back to the Vagrant host.
+[SSHFS](https://github.com/libfuse/sshfs). In the default mode it does
+this by executing the `SSHFS` client software within the guest, which
+creates an SSH connection from the Vagrant guest back to the Vagrant host.
The benefits of this approach:
- Works on any host platform and hypervisor type
- Windows, Linux, Mac OS X
- Virtualbox, Libvirt, Hyper-V, VMWare
@@ -33,11 +33,11 @@
This plugin was developed mainly by copying the code from the NFS synced
folder plugin from the Vagrant core code and molding it to fit SSHFS.
## Modes of Operation
-### Sharing Vagrant Host Directory to Vagrant Guest - 99% of users
+### Sharing Vagrant Host Directory to Vagrant Guest - 98% of users
This plugin uses SSHFS slave mounts
(see [link](https://github.com/dustymabe/vagrant-sshfs/issues/11))
to mount a directory from the Vagrant Host into the Vagrant Guest. It
uses the `sftp-server` software that exists on the host and `sshfs`
@@ -56,10 +56,23 @@
See [Options](#options-specific-to-arbitrary-host-mounting) and
[Appendix A](#appendix-a-using-keys-and-forwarding-ssh-agent) for
more information.
+### Sharing Vagrant Guest Directory to Vagrant Host - 1% of users
+
+*NOTE:* This option is dangerous as data will be destroyed upon `vagrant destroy`
+
+This plugin allows you to share a folder from a Vagrant guest into the
+host. If you have workloads where there are a lot of disk intensive
+operations (such as compilation) it may be ideal to have the files
+live in the guest where the disk intensive operations would occur.
+For discussion see [Issue #7](https://github.com/dustymabe/vagrant-sshfs/issues/7).
+
+See [Options](#options-specific-to-reverse-mounting-guest-host-mount)
+for more information on how to enable this type of mount.
+
## Getting Started
In order to use this synced folder implementation perform the
following steps:
@@ -85,17 +98,17 @@
section.
## Executing the `vagrant sshfs` Command
The Vagrant SSHFS plugin also supports execution of the `vagrant sshfs`
-command from the command line. Executing this command will
-iterate through the Vagrant file and attempt to mount (via SSHFS) any
-folders that aren't already mounted in the Vagrant guest that is
-associated with the current directory.
+command from the command line. Executing this command with the `--mount`
+option will iterate through the Vagrant file and attempt to mount (via
+SSHFS) any folders that aren't already mounted in the Vagrant guest.
+Executing with the `--unmount` option will unmount any mounted folders.
```
-vagrant sshfs
+vagrant sshfs [--mount|--unmount] [vm-name]
```
## Options
The SSHFS synced folder plugin supports a few options that can be
@@ -120,11 +133,11 @@
```
config.vm.synced_folder "/path/on/host", "/path/on/guest",
ssh_opts_append: "-o Compression=yes -o CompressionLevel=5",
sshfs_opts_append: "-o auto_cache -o cache_timeout=115200",
- disabled: false
+ disabled: false, type: "sshfs"
```
### Options Specific to Arbitrary Host Mounting
The following options are only to be used when
@@ -154,13 +167,53 @@
```
config.vm.synced_folder "/path/on/host", "/path/on/guest",
ssh_host: "somehost.com", ssh_username: "fedora",
ssh_opts_append: "-o Compression=yes -o CompressionLevel=5",
sshfs_opts_append: "-o auto_cache -o cache_timeout=115200",
- disabled: false
+ disabled: false, type: "sshfs"
```
+### Options Specific to Reverse Mounting (Guest->Host Mount)
+
+If your host has the `sshfs` software installed then the following
+options enable mounting a folder from a Vagrant Guest into the
+Vagrant Host:
+
+- `reverse`
+ - This can be set to 'true' to enable reverse mounting a guest
+ folder into the Vagrant host.
+
+An example snippet from a `Vagrantfile` where we want to mount `/data`
+on the guest into `/guest/data` on the host:
+
+```
+config.vm.synced_folder "/guest/data", "/data", type: 'sshfs', reverse: true
+```
+
+## FAQ
+
+Here are some answers to some frequently asked questions:
+
+### Why do new files take time to appear inside the guest?
+
+Sometimes it can take time for files to appear on the other end of the
+sshfs mount. An example would be I create a file on my host system and
+then it doesn't show up inside the guest mount for 10 to 20 seconds.
+This is because of caching that SSHFS does to improve performance.
+Performance vs accuracy is always going to be a trade-off. If you'd
+like to disable caching completely you can disable caching completely
+by appending the `cache=no` SSHFS option to the synced folder
+definition in the Vagrantfile like so:
+
+```
+config.vm.synced_folder "/path/on/host", "/path/on/guest",
+ type: "sshfs", sshfs_opts_append: "-o cache=no"
+```
+
+All caching options that are available to sshfs can be added/modified
+in this same manner.
+
## Appendix A: Using Keys and Forwarding SSH Agent
When [sharing an arbitrary host directory](#sharing-arbitrary-host-directory-to-vagrant-guest---1-of-users)
you may want a completely non-interactive experience. You can either
hard code your password in the Vagrantfile or you can use SSH keys.
@@ -193,18 +246,26 @@
```
## Appendix B: Development
-For local development of this plugin here is an example of how to build
-and install this plugin on your local machine:
+For local development of this plugin here is an example of how to build, test and install this plugin on your local machine:
```
-$ rake build
-vagrant-sshfs 0.1.0 built to pkg/vagrant-sshfs-0.1.0.gem.
-$ mkdir -p /tmp/gems/gems
-$ cp pkg/vagrant-sshfs-0.1.0.gem /tmp/gems/gems/
-$ pushd /tmp/gems/
-$ gem generate_index
-$ popd
-$ vagrant plugin install vagrant-sshfs --plugin-source file:///tmp/gems/
+# Install development dependencies
+$ gem install bundler && bundle install
+
+# List available Rake tasks
+$ bundle exec rake -T
+
+# Run Cucumber tests
+$ bundle exec rake featuretests
+
+# Build the gem (gets generated in the 'pkg' directory
+$ bundle exec rake build
+
+# Run Vagrant in the context of the plugin
+$ bundle exec vagrant <command>
+
+# Install built gem into global Vagrant installation (run outside of git checkout!)
+$ vagrant plugin install <path to gem in pkg directory>
```