How syncing host folders successfully?

156 views
Skip to first unread message

Francesco Zucca

unread,
Mar 31, 2017, 9:32:07 AM3/31/17
to Vagrant
Hi at all

I'm in trouble with sharing-syncing  folders between host and guest in a Vagrant managed VM.
My env is made by

vboxmanage  --version 5.1.18r114002
vagrant --version Vagrant 1.8.6

vagrant plugin list
vagrant-share (1.1.6, system)
vagrant-sshfs (1.3.0)
vagrant-vbguest (0.13.0)


Host Ubuntu 14.04.5 LTS 64 bit


I used this line in Vagrantfile for setup the folder syncing 

config.vm.synced_folder "/home/franzu/vagrant_data", "/vagrant_data"


Nothing in the message following the vagrant up, 
"==> default: Machine booted and ready!
[default] GuestAdditions 5.1.18 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Rsyncing folder: /home/franzu/VirtualBox VMs/fedora25/ => /vagrant
==> default: Mounting shared folders...
    default: /vagrant_data => /home/franzu/vagrant_data

but I can't get any good result.  

The host and guest folders are not connected.

I googled a lot around, testing dozen of hints, but nothing helps me.

Any idea?  
TIA
best,
franz


Alvaro Miranda Aguilera

unread,
Mar 31, 2017, 12:17:58 PM3/31/17
to vagra...@googlegroups.com
hello

try with hashicorp/precise64

if that works, then is something on the VM.

not all the boxes have virtualbox additions installed, and try to use other means to sync ie nfs or rsync, that can explain.

from the guest can you provide the following outoput

sudo mount

thanks
Alvaro.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/f06b167f-db8a-487a-afbf-65ec6874c725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Francesco Zucca

unread,
Apr 3, 2017, 3:12:49 AM4/3/17
to vagra...@googlegroups.com

Hi Alvaro
as suggested I test  hashicorp/precise64

I tested it both with rsync  and  nfs,

as in following excerpt of Vagrantfile
config.vm.synced_folder "../data", "/vagrant_data", type: "nfs"


but unfortunately I can't sync anything.


Here instead the output of mount on precise 64

vagrant@precise64:~$ sudo mount
/dev/mapper/precise64-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda1 on /boot type ext2 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)


Any hints?

thank
fz



You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/4IYiOuvcLKY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exZekD7s3EnCavLZAChRd6GP135rVRu8e4NY1qVMXt0yw%40mail.gmail.com.

Alvaro Miranda Aguilera

unread,
Apr 3, 2017, 7:32:18 AM4/3/17
to vagra...@googlegroups.com
Hello

Please share a Vagrantfile where I can see the nfs and other for the rsync please so I can copy paste and test.

for the hashicorp/precise64 please provide this output on any (or both?) of the test.

vagrant destroy
export VAGRANT_LOG=debug
vagrant up

and share the generated output over a gist in github (gist.github.com)

thanks!
Alvaro


For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Francesco Zucca

unread,
Apr 3, 2017, 10:10:13 AM4/3/17
to vagra...@googlegroups.com
Alvaro,

here the Vagrantfile with nfs active and rsync (commented) I used for precise64
and the links to github  debugs
vagrant_nfs.log
<script src="https://gist.github.com/frazucca/b38d08696e17bbcbe767b63ee719f84a.js"></script>

TIA
Best,
fz







Vagrantfile

Alvaro Miranda Aguilera

unread,
Apr 3, 2017, 2:46:52 PM4/3/17
to vagra...@googlegroups.com
Hello.

From the logs

on the rsync seems is not working due the path you are using

try to sync a folder to /home/vagrant/data as a test

this is what rsync is doing:
"/home/franzu/VirtualBox VMs/data/", "vag...@127.0.0.1:/home/vagrant"
so is overwriting and deleting /home/vagrant
this is wrong:
{:type=>:rsync, :guestpath=>"/home/vagrant", :hostpath=>"/home/franzu/VirtualBox VMs/data",

For the NFS the path is right in the configuration but something is stopping to be shared:
 * Exporting directories for NFS kernel daemon...
exportfs: /home/franzu/VirtualBox VMs/data does not support NFS export

Try to share a different path, one that doesn't have spaces for example. NFS is a old protocol and have some limitations.

here some generic info based on my test using your Vagrantfile:

want to share that this works for nfs:

0 kikitux ~/Downloads/z (master) $ vagrant ssh -c 'mount -t nfs'

192.168.56.1:/Users/kikitux/Downloads/z/data on /vagrant_data type nfs (rw,vers=3,udp,addr=192.168.56.1)

Connection to 127.0.0.1 closed.

0 kikitux ~/Downloads/z (master) $ cat Vagrantfile 

  Vagrant.configure("2") do |config|

  config.vm.box = "hashicorp/precise64"

  config.vm.network "private_network", ip: "192.168.56.13"

  config.vm.synced_folder "data", "/vagrant_data", type: "nfs"

  config.vm.provider "virtualbox" do |vb|

    vb.memory = "1024"

  end

end

0 kikitux ~/Downloads/z (master)


Tested on macOS


NFS from host to guest, requires the host is linux or macos and the guest is linux


rsync:

==> default: Configuring and enabling network interfaces...

==> default: Rsyncing folder: /Users/kikitux/Downloads/z/data/ => /vagrant_data

==> default: Mounting shared folders...

    default: /vagrant => /Users/kikitux/Downloads/z

0 kikitux ~/Downloads/z (master) $ cat Vagrantfile 

  Vagrant.configure("2") do |config|

  config.vm.box = "hashicorp/precise64"

  config.vm.network "private_network", ip: "192.168.56.13"

  config.vm.synced_folder "data", "/vagrant_data", type: "rsync"

  config.vm.provider "virtualbox" do |vb|

    vb.memory = "1024"

  end

end

0 kikitux ~/Downloads/z (master)


rsync required, rsync and ssh be installed on the host (ideally macos or linux) for windows the best is run vagrant from inside some environment where ssh and rsync are available


checking the gist now.


you are on a old vagrant please try to upgrade to latest version 1.9.3



Alvaro.



For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages