gael-ian / vagrant-bindfs

A Vagrant plugin to automate bindfs mount in the VM
MIT License
482 stars 37 forks source link

Folder content not syncing? #40

Closed itsazzad closed 8 years ago

itsazzad commented 8 years ago

Basically I am now in stuck to share /var/lib/mysql/. So I am sharing the /var/lib/mysql folder in ./mysql. Original config.vm.synced_folder "./mysql", "/var/lib/mysql", type: "nfs" was working fine except the permission errors. So I have chosen your plugin but unfortunately I could not make it work; the folder is not syncing. Seems to be that I am missing something. Can you please guide me? I am using OSX Yosemite. And the server is ubuntu/trusty64.

---Vagrantfile---

config.vm.box = "ubuntu/trusty64" 

#syncing nicely
    config.vm.synced_folder "./www",            "/var/www",             type: "nfs"
    config.vm.synced_folder "./apache2/etc",    "/etc/apache2",         type: "nfs"
    config.vm.synced_folder "./apache2/log",    "/var/log/apache2",     type: "nfs"
    config.vm.synced_folder "./apache2/php5",   "/etc/php5/apache2",    type: "nfs"
    ###config.vm.synced_folder "./mysql",           "/var/lib/mysql",       type: "nfs"

#Not syncing
config.bindfs.bind_folder "/var/lib/mysql", "./mysql", after: :provision

---bootstrap.sh---

sudo apt-get install mysql-server php5-mysql -y
sudo mysql_install_db

#tried with this also not working
sudo chattr -ia -R /var/lib/mysql
sudo chmod -R 755 /var/lib/mysql/
gael-ian commented 8 years ago

Hello,

vagrant-bindfs does not share anything between your host and your virtual machine. To synchronize ./mysql on your host with /var/libmysql on your guest and rewrite permissions, you have to share your ./mysql host folder with your VM and mount it somewhere (say /home/vagrant/mysql) and then bind this guest folder to /var/lib/mysql with correct permissions.

config.vm.synced_folder "./mysql", "/home/vagrant/mysql", type: "nfs"
config.bindfs.bind_folder "/home/vagrant/mysql", "/var/lib/mysl"

There's a long time I didn't test the plugin on an OS X host. In my memories, HFS+ filesystems won't work nicely with bindfs. So even if a correct configuration, you may have permissions problems.

Hope this helps.