mount -t nfs4 fails, but mount -t nfs succeeds [SOLVED]

Jonathan Ryshpan jonrysh at pacbell.net
Fri Apr 27 07:57:28 UTC 2012


On Thu, 2012-04-26 at 13:17 -0700, Jonathan Ryshpan wrote:
> On Thu, 2012-04-26 at 12:45 -0700, Jonathan Ryshpan wrote:
> > Can anyone explain this?  How can it be fixed?  Do some services need to
> > be started on the server?
> > 
> > The server is "weather".  This log is from the client:
> >         # mount -t nfs weather:/home/jonrysh /mnt/weather
> >         # ls /mnt/weather
> >         Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos  grub2
> >         # umount /mnt/weather
> >         # mount -t nfs4 weather:/home/jonrysh /mnt/weather
> >         mount.nfs4: mounting weather:/home/jonrysh failed, reason given by server:
> >           No such file or directory
> >         # 
> Following a suggestion in the Arch Linux Wiki:
>         https://wiki.archlinux.org/index.php/NFSv4#Exports
> I made this minor edit to /etc/exports on weather (the server)
> 
> Old /etc/exports:
>         /               amito(rw,no_root_squash)
>         /home/jonrysh   amito(rw,no_root_squash) 
> New /etc/exports:
>         /               amito(rw,fsid=0,no_root_squash)
>         /home/jonrysh   amito(rw,no_root_squash)
> Note that the addition of "fsid=0" to the entry for the root directory
> allows *both* the root and a directory under it to be exported.  To
> understand this better, read the following section in the Arch Linux
> Wiki: Exporting directories outside your NFS root
> 
> All very subtle, and undocumented.

What a lot of comments!  This deserves a reply at length.  I state a lot
of things below as fact.  But snce I'm still pretty ignorant about nfs4
some of them may not be true.  Those who know please put in corrections;
and we may arrive at the truth about something that's still pretty murky
to most people.  Comments on particular postings follow.

Nfs4 exports a tree of directories from a server to a client.  The root
of the tree must be the root of the filesystem on the host and the
line containing it in /etc/exports must contain the option fsid=root
(alternately fsid=0).  If such a line appears in /etc/exports then any
directory on the server can be exported, and the client can mount any
directory appearing there.  Nfs4 works through a firewall, provided
that port port 2049/tcp is opened; nfs3 requires that the firewall be
(completely) disabled.  "showmount -e <host>"  doesn't work through a
firewall, it appears to be associated with nfs3.  There is no utility
like it that works through port 2049/tcp; administrators have to know
which files are available via the nfs4 port from which servers.

There's an intro to setting up nfs4 (link from Ed Greshko) that states
that the fsid=0 option can be applied to any directory, and then other
directories to be exported should be (bound to) subdirectories of this
one; but I haven't been able to get it to work.  Funky problems:

1) If the client has an actual name or exact IP address in /etc/exports,
like this line:
        /nfs4           amito:/(rw,fsid=0,...)
or
        /nfs4           192.168.2.5(rw,fsid=0,...)
mount attempts fail with the message "No such file or directory".  

2)If the line in /etc/exports has a form like
        /nfs4           192.168.0.0/24(rw,fsid=0,...)
mount attempts fail with the message "access denied by server".
There's probably some problem with the options in the parentheses,
but I've tried them all, starting with the exact ones in the intro
without success.  On the other hand, exporting the actual root
        /               amito:(rw,fsid=0,..)
mounts fine.  

I hope to be enlightened.

Detailed comments follow:


Michael Cronenworth <mike at cchtml.com> wrote
> Jonathan Ryshpan wrote:
> > All very subtle, and undocumented.
> 
> $ man exports
> 
> /fsid[ENTER]
> 
> It is documented. You must understand that NFSv3 and NFSv4 are different
> in many ways.

So it is, in a sense.  But the documentation of fsid in the exports man
page isn't marked as having anything in particular to do with nfs4.

> P.S. I'm not sure why you want to export the entire file system when you
> are not mounting it on the remote end. Your "/" line could be removed.

Quite right.  But I didn't want to let exporting the root filesystem be
a red herring.


Veli-Pekka Kestilä <fedora at guagua.fi> wrote
> On 26.4.2012 22:45, Jonathan Ryshpan wrote:
> > ...
> Could you post your /etc/exports from "weather" as the exports syntax is 
> different for nfs3 and nfs4.

The exports *syntax* is the same in nfs4 as in nfs3.  There are
differences in *semantics* as I explained in my note at the start of
this posting.


Ian Pilcher <arequipeno at gmail.com> wrote
> On 04/26/2012 02:45 PM, Jonathan Ryshpan wrote:
> ...
> NFSv4 works very differently from previous versions.  You should be able
> to Google up plenty of documentation.

If only...  I spent most of a day Googling around before I found the
article in the Arch Linux Wiki.  Most of the stuff in my note at the
top doesn't seem to be anywhere obvious.


Robert P. J. Day <rpjday at crashcourse.ca> wrote
> ...
>   possibly off-topic but a long, long, *long* time ago, i wondered if
> you could set up a network using *exclusively* NFSv4, and found it was
> impossible -- at least one of the client programs required some
> earlier version of NFS even if it wasn't being used.
> 
>   any clarification on whether one can run a *purely* NFSv4 network?

The example network, though a very small one (2 machines) run nfs4 only.


Ed Greshko <Ed.Greshko at greshko.com> wrote
> ...
> When working with NFSv4 I sometimes consult this for reference....
> 
> http://www.crazysquirrel.com/computing/debian/servers/setting-up-nfs4.jspx

Very good reference.


Kernel Guardian <kernelgardian at gmail.com> wrote:
> ...
> what version of Fedora you use? (nfs server / nfs client)
> can you attach /etc/exports and /etc/syconfig/nfs files?
> can you attach /etc/sysconfig/iptables?
> > All of these files are from nfs server side.

Both systems are running Fedora-16 with all upgrades installed.

Unfortunately I have made so many changes to /etc/exports and the firewall
on the server that these would not be useful.




More information about the users mailing list