Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

NFS server inside container

2,278 bytes added, 18:01, 4 August 2021
warnings
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 serverin [[container]].
{{Note|for information about NFS client inside container, see [[NFS]].}}
== Kernel NFS server ==
Binary RPMs that are provided Kernel-space NFS server is supported by OpenVZ community contain latest RHEL5 and RHEL6 based kernels compiledand since vzctl-3.0.24.without NFS server NB! Currently only NFSv3 is supported - no NFSv4 supportyet. Thus you have  === Prerequisites ===In order torun an NFS server inside a container, make sure:[[Kernel build|recompile the * '''nfsd kernel]] with module is loaded on host system before starting a container'''* '''nfsd feature for a container is turned on''' (<code>vzctl set $CTID --feature nfsd:on --save</code>CONFIG_NFSD) === Setup ===m* Make sure that rpcbind service is started before nfs service:: <code>chkconfig rpcbind on && service rpcbind start</code>. After booting * Disable NFSv4 and nfsd module loading warnings in this /etc/sysconfig/nfs by uncommenting the following lines: MOUNTD_NFS_V3="yes" RPCNFSDARGS="-N 4" NFSD_MODULE="noload"* Start NFS service:: <code>chkconfig nfs on && service nfs start</code> === Troubleshooting === Make sure that:# you have enabled nfsd feature for your container# nfsd kernel module is loaded before you started the container ==== rpcbind ==== If you'll be ablesee this:<pre># service nfs start...to use Starting NFS server on [services: [HN] OK ]Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refusedrpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).</pre> It means you haven't started rpcbind service. Solution:<pre>chkconfig rpcbind on && service rpcbind start</pre> ==== nfsd module ====If you see this:<pre># service nfs start....In-kernel Starting NFS server runs kernel threads daemon: rpc.nfsd: Unable to service requests of clientsaccess /proc/fs/nfsd errno 2 (No such file or directory).Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart rpc.nfsd to correct the problemBut for security reasons kernel threads are prohibited in [ [containerFAILED]]s! So # mount -t nfsd nfsd /proc/fs/nfsdmount: unknown filesystem type 'nfsd'</pre> It means you wonhaven'tloaded nfsd kernel module on host before starting container.be able ==== warnings ==== If you see this:<pre># /etc/init.d/nfs startFATAL: Module nfsd not found.FATAL: Error running install command for nfsd...</pre> It is actually harmless, you don't need to do anything. In case you want this to run NFS server inside [[container]] without patching go away, uncomment (or add) the kernelline   NFSD_MODULE="noload" in <code>/etc/sysconfig/nfs</code> file.
== User-space NFS server ==
The current stable debian version 5.0 (lenny) provides two packages for user space nfs support: <code>nfs-user-server</code> and <code>unfs3</code>. Here i describe my experiences with them --[[User:Strimo|Strimo]] 17:47, 16 February 2009 (UTC)
 
It seems that also the unfs3 package has been removed from the debian repositories. --[[Special:Contributions/95.21.175.189|95.21.175.189]] 23:39, 30 July 2011 (UTC)
==== nfs-user-server ====
 
IMPORTANT : read http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=515957 , nfs-user-server was removed
<pre>
Works fine until now. Note that both unfs3 and nfs-user-server do not support file locking!
NOTE: I tested on centos 5.6 using unfs3 and I had to run the /etc/init.d/nfs service and see it work before I could use unfs. also use exports -a before using sudo /usr/sbin/unfsd -T -e /etc/exports
 
=== On CentOS 5 ===
 
If you are running RedHat/CentOS, you can [http://dag.wieers.com/rpm/packages/unfs3/ get unfs3 from the DAG repository]
== External links ==
Anonymous user