Changes

Jump to: navigation, search

NFS

2,158 bytes added, 19:34, 17 June 2016
Prepare the HN
This page describes how to mount use '''NFS partition client''' inside VEa container.
== NFS server ==Currently OpenVZ kernel doesn't include kernel NFS server support. Howether you are still able to use user space {{Note|see [[NFS server inside VEcontainer]]for info about nfsd.
== NFS client ==Mounting filesystems from the '''hardware node''' can be performed more elegantly using [[Bind mounts]].}} === Preparations ======= Prerequisites ====
You will need the following software:
# [http://openvz.org/download/utils#vzctl vzctl] version 3.0.13 or higher(do <code>vzctl --version</code>)# [http://openvz.org/download/kernel/ kernel] version 2.6.18-028test006 or higher (2.6.18-028stab* will do), or any recent RHEL5-based or 2.6.20-based kernel. Note: In all the kernels earlier than 028stab038, kernel NFS support can be given to a container by setting:
Note: In REL4 2.6.9-023stab044.4-smp kernel NFS support can be given to a VE by setting:
sunrpc.ve_allow_rpc = 1
fs.nfs.ve_allow_nfs = 1
kernel.ve_allow_kthreads = 1
=This can be done by adding the above lines into /etc/sysctl.conf on the hardware node, and then running <code>sysctl -p</code>. === Prepare the HN === For NFS mounts to work in the containers with the RHEL5-based kernels you must enable kernel threads in the container by setting <code>kernel.ve_allow_kthreads=1</code> in <code>/etc/sysctl.conf</code>. RHEL7-based kernels support [https://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-nfs.html three different NFS protocol versions]:{{Quote|NFS version 2 (NFSv2) is older and is widely supported.NFS version 3 (NFSv3) has more features, including 64bit file handles, Safe Async writes and more robust error handling.NFS version 4 (NFSv4) works through firewalls and on the Internet, no longer requires portmapper, supports ACLs, and utilizes stateful operations.Red Hat Enterprise Linux supports NFSv2, NFSv3, and NFSv4 clients, and when mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv3 by default, if the server supports it.}} Accordingly, there are three kernel modules: <code>nfs</code> (for NFSv2), <code>nfsv3</code>, and <code>nfsv4</code>. As [[NFS server inside container]] currently only supports NFSv3, it's very likely that you'll need to load <code>nfsv3</code> module for clients.  # modprobe nfs
For NFS mounts You will probably want the nfs module to load automatically on reboots. One way to do this is to work in put the VEs with the RHEL5-based kernels you must enable kernel threads in the VE by setting "kernel.ve_allow_kthreads=1" modprobe command in your /etc/sysctlrc.d/rc.conflocal file:
modprobe nfs Alternatively, you can add a new line with <code>nfs<pre/code>to your /etc/modules or /etc/modules.conf file.# modprobe === Prepare the container ===To allow a container to use NFS filesystem, you will need to start it with "nfs" feature enabled. If the container is running while you set the <code>--features nfs:on</precode>, you will need to reboot it.
==== Prepare the VE ====To allow a VE use NFS filesystem, you will need to start it with "nfs" feature enabled. If the VE is running while you set the --features "nfs:on", you will need to reboot it.<pre> # vzctl set 101 --features "nfs:on" --save # vzctl start 101</pre>
After this you may see nfs in <code>/proc/filesystems</code>
</pre>
=== Mounting NFS ===Make sure that packages <code>nfs-utils</code> and <code>nfs-utils-lib</code> or similar are installed in a container. Also make sure that the <code>portmap</code> (or <code>rpcbind</code>) service is started, otherwise the mount with default options will fail and require the <code>-nolock</code> option. See the [[NFS#Known issues|known issues]] for more information. Assuming that you already have NFS server set up at <code>192.168.0.1:/nfs_pub</code> , mounting will be simple
<pre>
# vzctl enter 100
</pre>
For more details on how to setup NFS mount , see [http://nfs.sourceforge.net/nfs-howto/ar01s04.htm html NFS-client HOWTO] == Known issues ==* There are quite a few parameters in NFS, so sometimes it doesn't work due to misconfiguration. We've created a separate page describing such situations: [[NFS doesn't work]].* Package nfs-common can not be installed. Make sure you start <code>portmap</code> before trying to install nfs-common.** For Ubuntu/Debian OpenVZ containers, the <code>portmap/rpcbind</code> service may not start automatically. However, you can enable it by editing the <code>/etc/default/nfs-common</code> configuration file.
=== Known issues =See also ==There are quite a few parameters in NFS, so sometimes it doesn't work due to misconfiguration* [http://nfs.sourceforge.net/nfs-howto/ar01s04. We created a separatepage for discribing such situation: [[ html NFS doesn't work ]-client HOWTO]
[[Category: HOWTO]]

Navigation menu