Difference between revisions of "NFS server inside container"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Kernel NFS server)
m (User-space NFS server)
Line 14: Line 14:
  
 
== User-space NFS server ==
 
== User-space NFS server ==
Advantage of user-space of NFS server is that it can be ran without any support in kernel.
+
Advantage of user-space NFS server is that it can be ran without any support in the kernel.
 
Also if it crashes - there is no crash of a system: just one process crashes, not kernel!
 
Also if it crashes - there is no crash of a system: just one process crashes, not kernel!
The disadvantage of user-space NFS server is its poductivity: noone can be faster then in-kernel implementation.
+
The disadvantage of user-space NFS server is its poductivity: no one can be faster then in-kernel implementation.
  
 
One well-known implementation of NFS server is "The LINUX User-Space NFS Server" by Olaf Kirch.
 
One well-known implementation of NFS server is "The LINUX User-Space NFS Server" by Olaf Kirch.
 
Some Linux distributions contain this package: Debian Sarge (nfs-user-server), OpenSuse 10.0 (nfs-server).
 
Some Linux distributions contain this package: Debian Sarge (nfs-user-server), OpenSuse 10.0 (nfs-server).
For other distribution you can download sources (for example from Debian repository) and compile it.
+
For other distributions you can download sources (for example from Debian repository) and compile it.
 
There is a small trick you have to know about runing mountd and nfsd (these two daemons and portmap constitute
 
There is a small trick you have to know about runing mountd and nfsd (these two daemons and portmap constitute
 
user-space server).  You should run them with -r option:
 
user-space server).  You should run them with -r option:
Line 28: Line 28:
 
# rpc.nfsd -r
 
# rpc.nfsd -r
 
</pre>
 
</pre>
The reason is that these daemons check major number of device there the directory to export resides.
+
The reason is that these daemons check major number of device where the directory to export resides.
If major equals 0 then daemons suppose that it is NFS and don't want to reexport it. Symptoms are
+
If major equals 0 then daemons suppose that it is NFS and don't want to re-export it. Symptoms are
that client will always get a "permission denied" error. Simfs (the file system on what VE is located)
+
that clients will always get a "permission denied" error. Simfs (the file system on what VE is located)
is assosiated with so called unnamed device, which major equals 0. To prevent daemons from checking
+
is assosiated with so called unnamed device, which major equals 0. To prevent daemons from checking for
reexporting - just use this -r option.
+
re-exporting - just use this -r option.
  
 
"The LINUX User-Space NFS Server" by Olaf Kirch implements NFSv2. It means that only files with sizes less
 
"The LINUX User-Space NFS Server" by Olaf Kirch implements NFSv2. It means that only files with sizes less
than 2GB proceeded. If you intend to use such big files then you should use other user-space NFS server
+
than 2GB are proceeded. If you intend to use such big files then you should use other user-space NFS server
implementation: unfs3 (http://unfs3.sourceforge.net/). It implenets v3 of NFS protocol standart.
+
implementation: unfs3 (http://unfs3.sourceforge.net/). It implemets v3 of NFS protocol standart.
  
  
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]
 
[[Category: Networking]]
 
[[Category: Networking]]

Revision as of 09:21, 24 August 2006

There are two ways to setup NFS server on common HN: use a user-space NFS server daemon or use an in-kernel implementation of NFS server. Some peculiarities appear if you intend to run NFS server in VE.

Kernel NFS server

Binary RPMs that are provided by OpenVZ community contain kernels compiled without NFS server support. Thus you have to recompile the kernel with CONFIG_NFSD=m. After booting in this kernel you'll be able to use NFS server on HN. In-kernel NFS server runs kernel threads to service requests of clients. But for security reasons kernel threads are prohibited in VE! So you won't be able to run NFS server inside VE without patching the kernel.

User-space NFS server

Advantage of user-space NFS server is that it can be ran without any support in the kernel. Also if it crashes - there is no crash of a system: just one process crashes, not kernel! The disadvantage of user-space NFS server is its poductivity: no one can be faster then in-kernel implementation.

One well-known implementation of NFS server is "The LINUX User-Space NFS Server" by Olaf Kirch. Some Linux distributions contain this package: Debian Sarge (nfs-user-server), OpenSuse 10.0 (nfs-server). For other distributions you can download sources (for example from Debian repository) and compile it. There is a small trick you have to know about runing mountd and nfsd (these two daemons and portmap constitute user-space server). You should run them with -r option:

# portmap
# rpc.mountd -r
# rpc.nfsd -r

The reason is that these daemons check major number of device where the directory to export resides. If major equals 0 then daemons suppose that it is NFS and don't want to re-export it. Symptoms are that clients will always get a "permission denied" error. Simfs (the file system on what VE is located) is assosiated with so called unnamed device, which major equals 0. To prevent daemons from checking for re-exporting - just use this -r option.

"The LINUX User-Space NFS Server" by Olaf Kirch implements NFSv2. It means that only files with sizes less than 2GB are proceeded. If you intend to use such big files then you should use other user-space NFS server implementation: unfs3 (http://unfs3.sourceforge.net/). It implemets v3 of NFS protocol standart.