vagrantfile synced_folder automount option how to

12 views
Skip to first unread message

Ed Greenberg

unread,
Nov 6, 2019, 9:08:59 AM11/6/19
to Vagrant
Host is Windows 10 and guest vagrant box is Centos/7 

I have these lines in my vagrantfile:

    rackspace_config.vm.synced_folder USER_DIR + "/www"   , "/var/www/html/"     , type: "virtualbox"
    rackspace_config
.vm.synced_folder USER_DIR + "/home"  , "/var/www/html/home" , type: "virtualbox"

When I start the vagrant box, /var/www/html is empty.   The shared folder is available, and shows up in the virtualbox console but that does not show the automount box as checked.

If I do this, the contents of USER_DIR/www appears:

 sudo mount -t vboxsf var_www_html_ /var/www/html

I read that an automount option is required.  I'm not sure how to specify this in the vagrant file  I tried this:

    rackspace_config.vm.synced_folder USER_DIR + "/www"   , "/var/www/html/"     , type: "virtualbox", automount: true

which I realize is a total stab in the dark, but the documentation is silent on the subject.  It didn't change anything. 

Can somebody tell me what the correct syntax is to add the automount option to the ...vm.synced_folder line? 

Thanks, 
Ed Greenberg

D Morgan

unread,
Nov 6, 2019, 1:18:34 PM11/6/19
to Vagrant
This is a variation on what you are attempting to do, as you can see automount: true is there:

remote.vm.synced_folder itm["src"], 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']


From what I can see, you are doing it correctly.

Reply all
Reply to author
Forward
0 new messages