# NFS Server under 8.0-Release



## vbelousov (Mar 2, 2010)

Hello all.

I installed new instance of 8.0-R and also configured NFS Server thru rc.conf

I wrote down following strings:


```
nfs_server_enable="YES"
nfs_flags="-t -u -n 20"      //just because of several nfs consumers at network.
rpcbind_enable="YES"
mountd_flags="-r"
```

And then after I restarted this machine I found that there are only two instances of nfsd  - one master and one server.
Later I commented nfs_flags option to use default vaules it changed nothing - situation were completely the same. 

Basically the problem is in a number of nfs consumers. As long as only one consumer is using nfs (i.e. ESXi) it works fine. But as soon as 2nd or 3rd consumers starts to work thru nfs, it affects like unexpected disconnections for CPEs. 

And one more thing, it was ok for 7.2 and for 8.0 RC1.

Any ideas? Am I doing something wrong?


----------



## JimW (Mar 3, 2010)

I am having the same problem with NFS on *FreeBSD 8.0-RELEASE-p2* i386.

Regardless of how I try to configure the machine and force four *nfsd* daemons to load (which should be the default), it won't do it.

This is it....


```
ps x | grep nfsd
  571  ??  Is     0:00.04 nfsd: master (nfsd)
  573  ??  S      0:00.01 nfsd: server (nfsd)
```

I temporarily set up a 7.2 workstation as an NFS server and that loads the default number of nfsd. It will load as many nfsd's as I tell it to..... including the 20 you wish to load.

I'm baffled.


----------



## vbelousov (Mar 7, 2010)

csup'ed to 9-CURRENT
Same story.


----------



## DutchDaemon (Mar 7, 2010)

This is a long shot, but this is not the way to insert comments:


```
nfs_flags="-t -u -n 20"      //just because of several nfs consumers at network.
```

Maybe the entire line is ignored because of it (though I'd expect the default of -n 4 to replace it, but syntax errors can cause weird behaviour).

Try


```
nfs_flags="-t -u -n 20"      ## just because of several nfs consumers at network.
```


----------



## vbelousov (Mar 7, 2010)

Thanks for your attention to my message. Actually with help from IKC, i soved this issue. For now ESXi (nfs storage) and both my media players works pretty fine.

The solution is to turn options in kernel:

My way was:

```
options 	nfsd
options 	DEVICE_POLLING
options 	HZ=1000
```

After I rebuid kernel with following otions everithing works fine as I wrote above.
Don't know, but probably nfsd option will be enought. It's definetelly needs to be tested.

P.S. Issue resolved, probably I have to make change to topic name? Shall I?
P.P.S. Ohh yeah. For now nfsd multithreaded, and it's only way to see one server process of nfsd. Just do not expect to see many processes.


----------



## vbelousov (Mar 7, 2010)

DutchDaemon said:
			
		

> This is a long shot, but this is not the way to insert comments:
> 
> 
> ```
> ...



I wrote this comment on forum only. It's mostly came from Java practice. But you are completelly right.
# is a proper mark for comments.


----------



## DutchDaemon (Mar 7, 2010)

Did you have this before?


```
options         NFSSERVER
```

Never even seen this one (though it's in LINT), nor do I understand the difference.


```
options         NFSD
```


----------



## vbelousov (Mar 7, 2010)

Hell I konw, but it works.

I didn't used  NFSSERVER options for now. Only NFSD.
May be it's some new option, like multithreaded NFSD?


----------



## DutchDaemon (Mar 7, 2010)

NFS has always been able to fork off numerous children (that's what -n is ...)


```
options         NFSSERVER               #Network File System server
options         NFSD                    #experimental NFS server with NFSv4
```

NFSv3 should've worked for you just as well. Anyhoo.


----------



## vbelousov (Mar 7, 2010)

Sure I agree, but for now you wouldn't be able to see processes. Not default 4 server processes, nor custom 20 as it set up in my conf sample.
For now it will be only one master and only one server. And who knows, will -n works for this multithreaded nfsd or not... 
For now I have 4+1 nfs consumers. And I have no problem with -n 20. I hope it works even thru a new, multithreaded way.


----------



## JimW (Mar 8, 2010)

Maybe creating a custom kernel is a successful workaround. But, it shouldn't be that way.

The GENERIC kernel by default should load four NFS server deamons. It does not do this in 8.0-RELEASE. At least not in the i386 version (I haven't yet tested amd64 yet). I tried it on three different machines with different types of network cards. It's a no go.

Just like other versions of FreeBSD, the /etc/defaults/rc.conf file has the same default value...


```
nfs_server_flags="-u -t -n 4"	# Flags to nfsd (if enabled).
```

On every other version of FreeBSD I have tested (including the most recent 7.3-RC2), the server will load whatever number of NFS server deamons you tell it to load. That is all right out of the box with the GENERIC kernel (I never tried any of the 8 Release Candidates).


```
nfs_server_flags="-u -t -n 20"
```

With the above line added to the /etc/rc.conf file on other versions of FreeBSD, the correct number of deamons is loaded. Change the number, and it will load whatever you tell it to load. That should be all you need to do. But that is not the case with 8.0-RELEASE and a GENERIC kernel.

Was there a change made in 8.0-RELEASE in regards to loading NFS and/or the syntax involved in loading a specific number of NFS server deamons?

I'm sure there are others having problems with NFS and 8.0-RELEASE. I'd hate to think I'm the only poor slob using GENERIC kernels and scratching my head.


----------



## vbelousov (Mar 8, 2010)

Jim, I wrote above that rumors sais   that for now NFSD is multitheaded process. 
This  means that there are not many instances of nfsd server process will be shown on ps.

Regarding custom kernel. I don't know. Maybe it was an effect of device polling option. It has to be tested for sure.


----------



## Sylgeist (Mar 14, 2010)

I am running this in my amd64 kernel config:


```
options 	NFSCLIENT		# Network Filesystem Client
options 	NFSSERVER		# Network Filesystem Server
options 	NFSLOCKD		# Network Lock Manager
options 	NFS_ROOT		# NFS usable as /, requires NFSCLIENT
```

and I still see:

```
root           823  0.0  0.0  4732  1380  ??  Is    5:08PM   0:00.02 nfsd: master (nfsd)
root           824  0.0  0.0  4732  1168  ??  S     5:08PM   0:00.13 nfsd: server (nfsd)
```

I haven't had any issues, but I am curious why the old behavior is not there.


----------



## tanakorn (Mar 24, 2010)

Are there anyone have document said that nfs in 8.0 is multi-theaded process? In release note, I found nothing mention about this behavior.


----------



## User23 (Mar 24, 2010)

http://www.FreeBSD.org/cgi/man.cgi?...ion=0&manpath=FreeBSD+8.0-RELEASE&format=html



> -n      Specifies how many servers to create.



And each server run in his own thread.


----------



## tanakorn (Mar 25, 2010)

User23 said:
			
		

> http://www.FreeBSD.org/cgi/man.cgi?...ion=0&manpath=FreeBSD+8.0-RELEASE&format=html
> 
> 
> 
> And each server run in his own thread.



In manpage, it said only



> -n Specifies how many servers to create.



but it didn't say nfsd is multithread process. I just wonder is there any documents to mention this 8.0 change from 7.x . I try to find them but I found nothing.


----------



## JimW (Mar 25, 2010)

tanakorn said:
			
		

> but it didn't say nfsd is multithread process. I just wonder is there any documents to mention this 8.0 change from 7.x . I try to find them but I found nothing.



I haven't found anything related to this problem either ....... And it IS a problem.

I have experienced serious NFS problems in 8.0 that do not exist in other releases. There was no multithreading of NFSD processes and copying large files back and forth from server to client was slow and problematic. Problems that did not exist in other recent releases. 

I gave up and downgraded my NFS servers back to 7.2-RELEASE.


----------



## vbelousov (Mar 25, 2010)

It's seems strange, because as soon as I rebuild kernel with NFS options it started to work fine.
I have no problem at all.


----------

