# NFS mounting problem.

## Uzytkownik

I follow gentoo wiki. However when I tries mount:

```
# mount 192.168.0.1:/usr/portage /mnt/portage -o ro -t nfs

mount: RPC: Unable to receive; errno = Connection refused

# mount 192.168.0.1:/usr/portage /mnt/portage -o ro -t nfs4

mount: permission denied

```

I have hosts.allow and export setted:

```
# cat /etc/hosts.allow 

portmap: *

lockd: *

rquotad: *

mountd: *

statd: *

status: *

# cat /etc/exports    

# /etc/exports: NFS file systems being exported.  See exports(5).

/usr/portage *(async,no_root_squash,no_subtree_check,rw)

```

What's wrong?

----------

## mtascii

you missed the ip in /etc/exports

here is mine

/musik 192.168.0.5(async,no_subtree_check,ro)

the * doesn't work

try 192.168.0.0/24

----------

## Uzytkownik

The same error.

----------

## Hu

On the system where you ran the mount commands, please run the following commands and post the results:

```
rpcinfo -p 192.168.0.1

rpcinfo -u 192.168.0.1 nfs

rpcinfo -u 192.168.0.1 mountd

showmount -e 192.168.0.1

```

----------

## Uzytkownik

```
# rpcinfo -p 192.168.0.1    

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100024    1   udp   4001  status

    100024    1   tcp   4001  status

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100003    4   udp   2049  nfs

    100003    2   tcp   2049  nfs

    100003    3   tcp   2049  nfs

    100003    4   tcp   2049  nfs

    100005    1   udp  32767  mountd

    100005    1   tcp  32767  mountd

    100005    2   udp  32767  mountd

    100005    2   tcp  32767  mountd

    100005    3   udp  32767  mountd

    100005    3   tcp  32767  mountd

# rpcinfo -u 192.168.0.1 nfs

program 100003 version 2 ready and waiting

program 100003 version 3 ready and waiting

program 100003 version 4 ready and waiting

# rpcinfo -u 192.168.0.1 mountd

rpcinfo: RPC: Timed out

program 100005 version 0 is not available

# showmount -e 192.168.0.1

Export list for 192.168.0.1:

/usr/portage 192.168.0.3

# nmap 192.168.0.1 -p 32767

Starting Nmap 4.20 ( http://insecure.org ) at 2007-03-07 06:57 CET

Interesting ports on 192.168.0.1:

PORT      STATE SERVICE

32767/tcp open  unknown

```

Regards

----------

## Hu

 *Uzytkownik wrote:*   

> 
> 
> ```
> # rpcinfo -p 192.168.0.1    
> 
> ...

 

There appears to be a problem accessing mountd.  On my NFS server, I get this for the rpcinfo: 

```
root@nfs-client# rpcinfo -u nfs-server mountd

program 100005 version 1 ready and waiting

program 100005 version 2 ready and waiting

program 100005 version 3 ready and waiting
```

Is there a firewall blocking access to some ports on 192.168.0.1?  You can check for an iptables firewall by running iptables --line-numbers -n -v -x -L.  Note that the -u option to rpcinfo directs it to use UDP.  Use -t to probe TCP services.  nmap defaults to checking TCP, so it may be that you are allowing TCP, but denying UDP.

By default, NFS mounts are done over UDP.  You can try forcing it to use TCP by including tcp in your mount options list.  I do not do this, so I cannot comment on the potential consequences of doing a TCP mount.  It might be useful for diagnostics though.

----------

## Uzytkownik

I forgot to unblock udp   :Embarassed: 

However:

```
# mount 192.168.0.1:/usr/portage /mnt/portage -o ro -t nfs

mount: 192.168.0.1:/usr/portage: can't read superblock

# mount 192.168.0.1:/usr/portage /mnt/portage -o ro -t nfs4

mount: Cannot allocate memory

```

----------

## Hu

Is portmap running on the NFS client as well?  A quick Google search of +NFS +"can't read superblock" turns up a thread at linuxquestions.org with similar symptoms.  If that is not the case, I would suggest checking the message logs on both client and server.  If you still do not see anything suspicious, use tcpdump to monitor the mount request, then load it up in Wireshark for dissection.  Beyond that, I'm running out of ideas.

----------

## Uzytkownik

I forgot after restart   :Embarassed:   (sorry - it's looks like I'm a lame). However we come back to:

```
# mount 192.168.0.1:/usr/portage /mnt/portage -t nfs4

mount: permission denied

```

```
PORT      STATE         SERVICE

111/tcp   open          rpcbind

4001/tcp  open          unknown

32767/tcp open          unknown

111/udp   open|filtered rpcbind

4001/udp  open|filtered unknown

32767/udp open|filtered unknown
```

PS.

nfs 3 works now

----------

## Hu

I have no experience with NFSv4, but do you get better results if you instead run: mount -t nfs -o nfsvers=4 192.168.0.1:/usr/portage /mnt/portage (using nfsvers=4 instead of setting the type to nfs4)?  Also, do you actually need NFSv4?

----------

