# Slow NFS-mount!

## Peter

I have some trouble mounting my nfs partitions. It works great with the same kernel config in my debian and slackware installations..but not in gentoo. It takes the partitions about five minutes to mount but then they work just fine... HELP!

----------

## Nitro

Are there any errors in the logs?  You do have portmap running right?  What kind of connection is between you and the NFS server?

----------

## toxborrow

I get the exact same problem, by mounting by hand:

```

root@wataru toby # time mount -t nfs 192.168.0.2:/xports/conf /mnt/conf

real    5m0.002s

user    0m0.000s

sys     0m0.010s

```

another filesystem type (xfs this time) by hand:

```

root@wataru toby # time mount -t nfs 192.168.0.2:/xports/media /mnt/media/

real    5m0.002s

user    0m0.010s

sys     0m0.000s

```

or with a fstab entry:

```

root@wataru toby # time mount -a -t nfs

real    5m0.007s

user    0m0.010s

sys     0m0.000s

```

The fstab entry being:

```
192.168.0.2:/xports/media  /mnt/media  nfs  rw,hard,intr  0 0
```

My logs arnt updated during this time, so they are no help.

My connection is a around 3 feet of networking cable connected by a hub. I've tried with my internet connection on and off, just in the hope it was some weird routing issue.

The server is hosting 3 mount points, two are xfs and one is ext3. All three take the same 5 minutes to mount.

When i issue the mount request from a client, i can hear the server harddrive buzz for a split second and its hdd light blinks. This seems to indicate that its not a client->server connection related issue. I can ping client->server and server->client fine.

Unmounting is instant, trying to remount takes the same 5 minutes.

The server mounts the partitions locally fine and with no errors, however i did have to increase the 'sleep' in /etc/init.d/nfs (line 55) from 5 seconds to 10 because the script appeared to be killing the exportfs command before it finished. 

Once the filesystems are mounted by the client, I can use them without any long delays (ie, "touch foo" doesnt take 5 minutes, it's instant, as I would expect)

 *Quote:*   

> You do have portmap running right?

 

I'm not sure, I just edited /etc/conf.d/nfs then run the /etc/init.d/nfs script.

I never went out of my way to setup portmap.

"ps ax" shows portmap running.

The fact this takes exactly 5 minutes is curiuous, as if some sort of timeout is in place.

----------

## Nitro

 *toxborrow wrote:*   

> I'm not sure, I just edited /etc/conf.d/nfs then run the /etc/init.d/nfs script.
> 
> I never went out of my way to setup portmap.
> 
> "ps ax" shows portmap running.

 

I added portmap to my default run level so it is started automatically, quick of checking:

```
 # rpcinfo -p localhost

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100021    1   udp  32768  nlockmgr

    100021    3   udp  32768  nlockmgr

    100021    4   udp  32768  nlockmgr
```

I don't have any nfs related services starting up with the exception of portmap and this is my time:

```

 # time mount -t nfs -o rsize=8192,wsize=8192,mountvers=3,users viper:/mp3 /mp3

real    0m0.010s

user    0m0.004s

sys     0m0.004s

```

So, if it takes me 10ms to mount it, and takes you 5 minutes, something is seriously wrong.

 *toxborrow wrote:*   

> The fact this takes exactly 5 minutes is curiuous, as if some sort of timeout is in place.

 

I'm not sure if this is your problem, but check that both boxes can inversely resolve both IP addresses.  I tried to hack up my DNS so that they couldn't resolve each other, and both failed.  Just add two lines to each /etc/host.

That does seem *very* weird.  Is this a new problem?  Also, I saw that you checked your logs, but did you also check your server's logs?

----------

## toxborrow

This isnt a new problem, its been like this since I installed Gentoo on the server.

Both client and server have each others hostnames and IPs in their hosts, I did check they wernt trying to resolve the name some other way by removing my resolv.conf and turning off my firewall that hosts a local dnscache.

I'm running metalog, nothing was added during the time of the mount to either /var/log/everything/current or /var/log/kernel/current.

The only thing mount related that gets logged is unmount requests from the client when I shutdown the client.

I'm starting nfsd on the server at boot via the /etc/init.d/nfs which starts:

portmap, statd, exports the directorys, nfs demons, mountd

The only option I set to /etc/conf.d/nfs was to reduce the number of nfsd's started from 8 to 6. I guess /etc/init.d/nfs got added to the default runlevel when I installed nfs-utils because I didnt do it myself.

How are you starting only portmap, I'd like to give that a try but I cant quite work out what to do. I tried starting it manually but the cleint gets an error about "RPC: Program not registered", which as far as I know means is the client cant find anything on the server to connect to. So I probably havnt started enough on the server to allow the client to mount off it.

Heres some other info:

```
mathilda nfs # cat /proc/fs/nfs/exports 

# Version 1.1

# Path Client(Flags) # IPs

/xports/conf    wataru(rw,root_squash,async,wdelay) # 192.168.0.101

/xports/src     wataru(rw,no_root_squash,async,wdelay) # 192.168.0.101

/xports/media   wataru(rw,root_squash,async,wdelay) # 192.168.0.101

/xports/conf    nikita(rw,root_squash,async,wdelay) # 192.168.0.103

/xports/src     nikita(rw,no_root_squash,async,wdelay) # 192.168.0.103

/xports/media   nikita(rw,root_squash,async,wdelay) # 192.168.0.103

/xports/conf    192.168.1.101(rw,root_squash,async,wdelay) # 192.168.1.101

/xports/src     192.168.1.101(rw,no_root_squash,async,wdelay) # 192.168.1.101

/xports/media   192.168.1.101(rw,root_squash,async,wdelay) # 192.168.1.101
```

```
mathilda nfs # cat /etc/hosts

127.0.0.1       localhost

192.168.0.1     akira

192.168.0.2     mathilda

192.168.0.101   wataru

192.168.0.102   andy

192.168.0.103   nikita
```

```
mathilda nfs # rpcinfo -p localhost

   program vers proto   port

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100024    1   udp   1024  status

    100024    1   tcp   1024  status

    100011    1   udp    692  rquotad

    100011    2   udp    692  rquotad

    100003    2   udp   2049  nfs

    100003    3   udp   2049  nfs

    100021    1   udp   1026  nlockmgr

    100021    3   udp   1026  nlockmgr

    100021    4   udp   1026  nlockmgr

    100005    1   udp   1027  mountd

    100005    1   tcp   1025  mountd

    100005    2   udp   1027  mountd

    100005    2   tcp   1025  mountd

    100005    3   udp   1027  mountd

    100005    3   tcp   1025  mountd
```

----------

## toxborrow

Well that is most curious, I just mounted an export from my laptop which runs Sorcerer Linux and it mounted instantly, which would make me think its nothing to do with the server at all.

The other client that experiences the 5 minute delay has iptables on it, but just to be sure I flushed all the rulesets. This hasnt helped at all. (the server nor my laptop run iptables)

----------

## Nitro

 *toxborrow wrote:*   

> 
> 
> How are you starting only portmap, I'd like to give that a try but I cant quite work out what to do. I tried starting it manually but the cleint gets an error about "RPC: Program not registered", which as far as I know means is the client cant find anything on the server to connect to. So I probably havnt started enough on the server to allow the client to mount off it.
> 
> 

 

I start it with:

```
/etc/init.d/portmap start
```

I also added it to my default runlevel.  Never had a problem.  :Sad:   Don't know what else to tell ya.  When you do find a solution, I'd be interested in hearing it.  :Smile: 

----------

## Peter

I have about the same system and the same sympthoms as toxborrow but I know that the server works fine. It runs slackware and I can connect without problems from other computers and from this one when running another linux distribution. I guess it's some kind of configuration issue... is there anyone who has a clue about this?

----------

## toxborrow

gagh, you said the answer yet I hadnt quite twigged you meant portmap needs to be running on the client. Well I take this as what you meant, since once I loaded portmap, I could mount instantly.

So...

If it takes 5 minutes to mount an NFS share, check you have portmap running on the client.

Check with:

```
rpcinfo -p localhost
```

Run with:

```
/etc/init.d/portmap
```

And assuming we want to do this every boot, instead of manually typing in the above command:

```
rc-update add portmap "default"
```

Yay.

----------

## Nitro

Yup! Sorry for the confusion.  Glad to hear it works.

----------

## tale

NFS is a weird thing...

Before I installed Gentoo on my Server I had OpenBSD running. I had severe problems with NFS, mounting was SO slow, transfer rate was ~50kb/sec via an 100MBit/sec-line... Client was a Slackware box. (Samba and other stuff was slow, too ... at the end I found out that OBSD had problems with my IDE-Controller and that slowed my Net-Connection  :Sad: 

Then I changed from OBSD to Gentoo... mounting was fast, but transfer rate was just ~ 1 Meg/sec. hm  :Sad:  Samba speed was 8 Megs/Sec, quite good - but Slack NFS and Gentoo NFS didn't like each other. As soon as i changed my Client OS to Gentoo, everything goes very very well  :Smile: ))

I asked some guys, BSD People and Linux People, about NFS, and all told me that NFS is a strange subject. Linux NFS is not a very mature thing, and there have been numerous problems with NFS Servers / Clients interacting when using different NFS Versions (Software Versions)...

So: Try to use ~ the same versions for server and client NFS (Gentoo Linux, the same Kernel). Try to check if there is a hardware fault. Check DNS issues (/etc/hosts is your friend!). How is your ftp throughput? (Should be slighty better than NFS, but 1meg to 7 meg is NOT normal  :Wink: 

Think about alternatives - do you *need* NFS? There is an experimental FTP FS patch for Linux, cannot remember the URL, but google for it or try freshmeat. You can also mount the SMB Filesystem.

So - have fun!  :Wink: 

----------

## strife

I have two machines that I  recently converted over to Gentoo, the one had no problem connecting to my server's NFS the other one had this EXACT  problem.  After emerging nfs-utils I could mount, upon rebooting it seems portmap wasn't loading.

I'm fairly certain I followed the same steps for both machines, because I don't recall anything out of the ordinary to get nfs client working.

----------

## debian

Hmm...sorry to cutting in so late, but I just want to say if you want to eliminate the slow delay, the server ANDclient must have portmap running. That's a common mistake people have with NFS. Yes I admit that NFS is very slow and far from complete, it's a SUN's stuffs nevertheless.  :Smile: 

----------

