Vagrant 2.2.6 sync folders doesn't work on CentOS 7 using VirtualBox

26 views
Skip to first unread message

Stack Bugs

unread,
Nov 1, 2019, 2:06:53 PM11/1/19
to Vagrant
Vagrant version: 2.2.6
Virtualbox Version: 6.0.14
Host OS: macOS Mojave 10.14.6
VM OS: CentOS 7 (1905.1)
Vagrant Addon: vagrant-vbguest 0.20


I have a virtual machine setup but sync folders with virtualbox doesn't work. Anyone with similar issues or a solution to help? Thank you in advance.

Below is the Vagrantfile used.

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.hostname = "CentOS"

  config.vm.network "forwarded_port", guest: 80, host: 8080,
    auto_correct: true

  config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  config.vm.synced_folder ".", "/vagrant", type: "virtualbox"

  # Ansible Provisioning
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "ansible/dev_setup.yml"
  end
end



I have also attached the VBox.log files, if it will help.
VBox.log
VBox.log.3

.

unread,
Nov 1, 2019, 5:34:21 PM11/1/19
to vagra...@googlegroups.com
synced_folder's can be really inconsistent with the type: "virtualbox". As you are figuring out it only does the initial sync and then doesn't update anything afterwards.

I am recursively generating my shared folders, based on a yaml file. However, the original link is in the comments and  this works as you'd expect

      # Vagrant was having an issues with mounting folders on vagrant reload
      # Folders would mount but would be empty with type: "virtual-box".
      # I changed the default to nfs based on this recommendation
      # https://blog.theodo.com/2017/07/speed-vagrant-synced-folders/
      folders = instance["folders"] ? default_folders | instance["folders"] : default_folders
      folders.map.with_index do |itm, index|
        remote.vm.synced_folder , itm["dest"],
          id: itm["src"].match(/[^\/]*$/)[0] + "-#{index}",
          create: true,
          automount: true,
          type: "nfs",
          mount_options: ['rw', 'vers=3', 'tcp'],
          linux__nfs_options: ['rw','no_subtree_check','all_squash','async']
      end



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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 vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/ca9a12df-4b87-430b-a1bb-7733fce22f6a%40googlegroups.com.


--
Dan Morgan
Reply all
Reply to author
Forward
0 new messages