13

I have configured Vagrant to use Rsync shared folders instead of the (incredibly SLOW) vboxsf filesystem provided by VirtualBox by default:

Vagrant.configure("2") do |config|
    config.vm.synced_folder ".", "/vagrant", type: "rsync",
        rsync__args: ["--verbose", "--archive", "-z"]
end

Obviously, there's more configuration, but I found these instructions here and they generally work in synchronizing from the host to the guest.

However, I need the guest to be able to sync back to the host, as some of my build tools are only installed on the guest. How can I sync bidirectionally in the shared folder?

Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411

3 Answers3

18

Consider using a vagrant plugin https://github.com/smerrill/vagrant-rsync-back#vagrant-rsync-back

Install:

vagrant plugin install vagrant-rsync-back

Run:

vagrant rsync-back

It'll rsync the mapped folders from guest to host

Let'sTalk
  • 433
  • 5
  • 8
6

Unfortunately no, quote from documentation:

The rsync synced folder does a one-time one-way sync from the machine running to the machine being started by Vagrant.

so better for you to use NFS (or SMB if using a Windows host)

In some cases the default shared folder implementations (such as VirtualBox shared folders) have high performance penalties. If you're seeing less than ideal performance with synced folders,

the6p4c
  • 644
  • 5
  • 17
vvchik
  • 1,210
  • 1
  • 8
  • 16
  • 2
    This is false; the vagrant box is visible as a computer on the network. You can `scp` to it or from it as you can see here: http://stackoverflow.com/a/31764721/5419599 So you could just do a recursive `scp`. I'm sure there is a way to `rsync` as well, even if not automatically. – Wildcard Dec 24 '15 at 07:22
3

Consider using this vagrant plugin http://github.com/dmatora/vagrant-unison It does realtime bidirectional folder sync

dmitry.matora
  • 111
  • 1
  • 4