I haven't used Vagrant on Linux for a while. When I started using the new version (Vagrant 1.8), I was faced with a problem: files created inside the guest VM didn't appear on the host machine's synced folder.
How do I force Vagrant to sync files from the guest OS to the host OS?
According to documentation, when
type
optionconfig.vm.synced_folder
parameter in Vagrantfile is not specified, Vagrant tries to choose best available option:Starting with version 1.5 Vagrant introduced new "rsync synced folders" feature.
So in my case type
rsync
was automatically chosen, which is one-way sync: from host to guest.To make folders sync in two-way I added explicit definition in my Vagrantfile:
Of course, this will work only for VirtualBox.
Two way sync is useful for workflows, where apllication on guest machine creating files, for example, database migration files in modern web frameworks.
Note: virtualbox synced folders have known performance issues when your project has large amount of files.
Thanks for this it was exactly what I have looking for the past several days !!!!! I had this problem with Laravel 5, homestead and vagrant. Many answers out there but none that worked for me. I also had rsync in my folders section of my yaml file that I also had to remove. After these two changes file sharing was finally sync for me between the host and client.
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
Here is where I made the change to my Vagranfile.