Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant reload synced_folder

Here is my Vagrantfile.

config.vm.define :web do |web|
 web.vm.box = "ubuntu/trusty64"
 web.vm.network "private_network", ip: "192.168.100.111"
 web.vm.network "forwarded_port", guest: 22, host: 4444,  id: "ssh", auto_correct: true  
 web.vm.synced_folder "./web/", "/srv/"

web.vm.provider "virtualbox" do |vb|
 vb.gui = true
 vb.name = "web"
 vb.cpus = 2     
 vb.memory = "1024"
end
end

I have my VM work fine, but i need to change web.vm.synced_folder "./web/", "/srv/" to another paths. I try to change it and than vagrant reload, vagrant provision, vagrant reload web --provision, and all the other posibile variants of that. These actions won't have effect. The only way to change synced folders is to destroy VM and up it again. This is not what i want. I need to reload configuration without destroying VM and that is the issue it won't work for me.

like image 519
Alexey Antipin Avatar asked Jan 06 '16 17:01

Alexey Antipin


1 Answers

That hasn't been my experience with synced folders, so it's very strange that you're seeing this behavior. From the Vagrant docs...

Synced folders are automatically setup during vagrant up and vagrant reload.

I just tested it with one of my Vagrant boxes and it worked fine. I changed the local folder, did a vagrant reload, and then checked it on the box. Ditto after changing the remote folder.

Given your situation, there's an option you could try. You may be able to disable a synced folder, run vagrant reload, update and re-enable it, and then vagrant reload again. Here's how to disable a synced folder...

web.vm.synced_folder "./web/", "/srv/", disabled: true

Or you may be able to comment the line, run vagrant reload, uncomment and change it, and then vagrant reload again.

I can't vouch for these approaches because I can't reproduce your issue. It just works for me regardless.

like image 119
Patrick Lee Avatar answered Nov 02 '22 13:11

Patrick Lee