Reputation: 95
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.
Upvotes: 7
Views: 4672
Reputation: 490
I encountered a similar issue, in my case it was resolved by ensuring that the previous folder still existed on the host machine. Otherwise, I was getting an error that it didn't exist (which it didn't, because that's why I wanted to use a different host folder!).
Upvotes: 0
Reputation: 71
You need to have the additional VBoxGuesstAdditions added to your VBox in order to have fully synched folders. Folders will be synched with your host continuously so modifications to files from host and guest can be observed from both the host as the guest. See https://www.virtualbox.org/manual/ch04.html.
Upvotes: 0
Reputation: 2013
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.
Upvotes: 6