New vagrant-mirror plugin (for 1.0.x) to workaround shared folder performance

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

New vagrant-mirror plugin (for 1.0.x) to workaround shared folder performance

Andrew Coulton
We've been using Vagrant for a while and, as with many others, have had real issues with Virtualbox shared folder performance for projects with large codebases. The standard alternative, NFS shared folders, doesn't really work when using a Windows host especially if you want to keep dependencies on the host to the bare minimum.

As a workaround, I've built the vagrant-mirror gem ( which:
  • uses rsync to copy files from your shared folder to a directory on the guest virtual disk. Rsync runs entirely on the guest to minimise dependencies on the host.
  • monitors the host filesystem (using the listen gem from guard) and updates deleted, new or changed files on the guest in realtime
  • allows you to exclude paths (docs, for example) that are not required
  • can symlink from paths within your mirrored directory back to the virtualbox shared folder - so that you still see changed files on the host in specific paths where this matters to you
  • can beep when it completes a transfer - which you may find useful to know when you can reload your page, for example.
  • hooks directly into vagrant up to run a full sync just after shared folders are mounted, and to begin continuous realtime monitoring once the other vagrant up tasks have completed.
In addition to significant performance improvements, the plugin also works around the lack of support for symlinks on a virtualbox shared folder - your mirror folder is a folder on the guest virtual disk like any other. It will also allow you to work around the lack of inotify events on a shared folder - either by running guard on the guest or in future by defining event handlers in your Vagrantfile.

The plugin is fully tested with rspec and (I think) reasonably well documented. Ruby's not my first language (by a long shot) but I've tried to follow conventions where I can - fgrehm's vagrant-notify plugin was very useful as an example as was the vagrant source.

Future plans include:
  • exposing event callbacks to the Vagrantfile to allow you to run custom actions (perhaps flushing files from opcode cache) following file events
  • some performance tweaks for edge cases like deleting large folder trees instantaneously
  • tidying up how you quit the monitoring mode (for now, just Ctrl+C twice)
  • improved sync progress feedback
View and contribute to the roadmap on the github issue tracker at Bug reports and pull requests are also welcome and should be contributed via github.

The plugin only supports vagrant 1.0 at the moment. Support for 1.1 is planned, and help or encouragement to do so is welcome!

Hope you find it useful,


You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit