Hello,

This is what I mean by nested folder over nfs:

  config.vm.synced_folder "/home/chris/", "/home/vagrant/home-chris",
create: true, :nfs => true, :mount_options => ['nolock']
  config.vm.synced_folder "/home/chris/MyFolder",
"/home/vagrant/home-chris-MyFolder", create: true, :nfs => true,
:mount_options => ['nolock']


Don't do that, you may run into issues in some OS.. in linux I think
is fine.. but not sure for all .. howevert in other host os like OSX
it won't work.

if you want to mount   /home/vagrant/home-chris/MyFolder as
/home/vagrant/home-chris-MyFolder, you can do:

in the guest, as root:

mountpoint /home/vagrant/home-chris 2>/dev/null && ( mkdir -p
/home/vagrant/home-chris-MyFolder ; mount -t bind
/home/vagrant/home-chris/MyFolder /home/vagrant/home-chris-MyFolder)

if that works for what you want, then I will suggest use a shell
script to do that.

you can use run: "always" to make the script run once guest boot.

Alvaro.

On Thu, Feb 26, 2015 at 4:09 PM,  <[email protected]> wrote:
>
> Thanks Alvaro,
>
> I am doing my tests with just one VM, so folders are shared to only this VM
> with with nfs.
> The full /etc/exports of the non-working case (mounting
> /home/chris/MyFolder) is in my initial post.
>
>
> Now, the really insane thing is that I found a workaround to be able to
> mount /home/chris/MyFolder
> This work around is... to mount both /home/chris and /home/chris/MyFolder (I
> guess in that order):
> So, using those lines in Valgrant file:
>   config.vm.synced_folder "/home/chris/", "/home/vagrant/home-chris",
> create: true, :nfs => true, :mount_options => ['nolock']
>   config.vm.synced_folder "/home/chris/MyFolder",
> "/home/vagrant/home-chris-MyFolder", create: true, :nfs => true,
> :mount_options => ['nolock']
>
>
> Resulting in those lines in /etc/exports:
> # VAGRANT-BEGIN: 1000 dd512a07-aa4e-4971-a8ac-cf2a891889d6
> "/home/chris"
> 10.11.12.13(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=1372930016)
> "/home/chris/MyFolder"
> 10.11.12.13(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=1914143178)
> # VAGRANT-END: 1000 dd512a07-aa4e-4971-a8ac-cf2a891889d6
>
> So this work, and I think I can live with that at the moment. However, it
> makes absolutely no sense, and I would love if someone smarter than me could
> explain me this :)
>
> Cheers
>
> Christophe
>
> On Thursday, 26 February 2015 14:00:15 UTC+11, Alvaro Miranda Aguilera
> wrote:
>>
>> Hello
>>
>> make sure you are not exporting nested folders
>>
>> that is, if one vm use
>>
>> "/home/chris/MyFolder"
>>
>> and some other use
>>
>> "/home/chris"
>>
>> that may cause issues
>>
>> so, make sure you share at same level
>>
>> can you share your host /etc/exports ?
>>
>> On Thu, Feb 26, 2015 at 3:16 PM,  <[email protected]> wrote:
>> > Hi all,
>> >
>> > I have spent quite a lot of time trying to get nfs working with Vagrant,
>> > without much success so far.
>> >
>> > When trying to enable nfs-mounting, for example with this line in the
>> > Vagrant file:
>> >
>> > config.vm.synced_folder "/home/chris/MyFolder",
>> > "/home/vagrant/myfolder",
>> > create: true, :nfs => true, :mount_options => ['nolock']
>> >
>> >
>> >
>> > On Vagrant up, the system hangs and timeout with this error message
>> > mount.nfs: access denied by server while mounting
>> > 10.11.12.1:/home/chris/MyFolder
>> >
>> > For info:
>> > 1. The permissions of MyFolder are:
>> > [chris@localhost ~]$ ls -la /home/chris/MyFolder/
>> > total 40
>> > drwxrwxr-x   2 chris chris  4096 Feb 26 12:51 .
>> > drwx------. 72 chris chris 36864 Feb 26 12:51 ..
>> > -rw-rw-r--   1 chris chris     0 Feb 26 12:51 myfile
>> >
>> > 2. I disabled firewalld (internet says somewhere that fedora firewalld
>> > and
>> > Vagrant don't play well together):
>> > [root@localhost chris]# systemctl status firewalld
>> > ● firewalld.service - firewalld - dynamic firewall daemon
>> >    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
>> >    Active: inactive (dead) since Thu 2015-02-26 12:57:21 AEDT; 3s ago
>> >   Process: 5856 ExecStart=/usr/sbin/firewalld --nofork --nopid
>> > $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
>> >  Main PID: 5856 (code=exited, status=0/SUCCESS)
>> >
>> > 3. I created some exportfs symlink (again, the internet advised me to do
>> > so)
>> > ll /usr/bin/exportfs
>> > lrwxrwxrwx 1 root root 18 Feb 26 10:52 /usr/bin/exportfs ->
>> > /usr/sbin/exportfs
>> >
>> > 4. The content of /etc/exports is:
>> > [root@localhost chris]# cat /etc/exports
>> > # VAGRANT-BEGIN: 1000 9e05560d-b335-4bd7-8c29-8d48f005873f
>> > "/home/chris/MyFolder"
>> >
>> > 10.11.12.13(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=1914143178)
>> > # VAGRANT-END: 1000 9e05560d-b335-4bd7-8c29-8d48f005873f
>> >
>> > Now, the things that drives me insane is that I can nfs-mount
>> > /home/chris:
>> > config.vm.synced_folder "/home/chris/", "/home/vagrant/home-chris",
>> > create:
>> > true, :nfs => true, :mount_options => ['nolock']
>> >
>> > I have repeated this process carrefully several times, checked
>> > /etc/exports,
>> > make sure firewalld was disabled, destroy the VM.
>> >
>> >
>> > Can someone help me with this issue?
>> >
>> > Thanks,
>> >
>> > Christophe
>> >
>> > --
>> > 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 [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to