I can't get the /vagrant folder to synchronize. It will synchronize from Windows host to CentOS guest, but only if I manually run vagrant rsync
or vagrant up
, and will delete any new files in the guest. It won't sync from guest to host.
$ vagrant ssh
Last login: Wed Mar 15 21:00:00 2017 from 10.0.2.2
[vagrant@localhost ~]$ cd /vagrant
[vagrant@localhost vagrant]$ ls
Vagrantfile vagrant.log
[vagrant@localhost vagrant]$ touch tmp.txt
[vagrant@localhost vagrant]$ ls
tmp.txt Vagrantfile vagrant.log
[vagrant@localhost vagrant]$ exit
logout
Connection to 127.0.0.1 closed.
Chloe@xps /cygdrive/c/Users/Chloe/Documents/server
$ ls
vagrant.log Vagrantfile
I tried to manually mount and it gave an error
[vagrant@localhost vagrant]$ sudo mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
I tried to manually set a shared folder in VirtualBox interface and restarted
It doesn't give any errors on vagrant up
and there is nothing in the debug log.
Version 5.1.16 r113841 (Qt5.6.2)
CentOS Linux release 7.3.1611 (Core)
Windows 8.1
Best Answer
I fixed it by changing the name (1st column) of
/vagrant
in VirtualBox tovagrant
and manually running this command inside the guest:Not even selecting 'Auto mount' checkbox will mount it automatically. By the way, 1000 is the uid and gid of
vagrant
user.id -u vagrant; id -g vagrant
You can add this to your
Vagrantfile
: