<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Adrimcgrady</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Adrimcgrady"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Adrimcgrady"/>
	<updated>2026-04-30T05:57:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=NFS&amp;diff=7153</id>
		<title>NFS</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=NFS&amp;diff=7153"/>
		<updated>2009-03-19T11:39:10Z</updated>

		<summary type="html">&lt;p&gt;Adrimcgrady: /* ISSUE: can't install nfs-common on ubuntu VE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes how to mount NFS partition inside a container.&lt;br /&gt;
&lt;br /&gt;
== NFS server ==&lt;br /&gt;
Currently OpenVZ kernel doesn't include kernel NFS server support. However you are still able to use user space [[NFS server inside container]].&lt;br /&gt;
&lt;br /&gt;
== NFS client ==&lt;br /&gt;
=== Preparations ===&lt;br /&gt;
==== Prerequisites ====&lt;br /&gt;
You will need the following software:&lt;br /&gt;
&lt;br /&gt;
# vzctl version 3.0.13 or higher (do &amp;lt;code&amp;gt;vzctl --version&amp;lt;/code&amp;gt;)&lt;br /&gt;
# 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.&lt;br /&gt;
&lt;br /&gt;
Note: In all the kernels earlier than 028stab038, kernel NFS support can be given to a container by setting:&lt;br /&gt;
&lt;br /&gt;
      sunrpc.ve_allow_rpc = 1&lt;br /&gt;
      fs.nfs.ve_allow_nfs = 1&lt;br /&gt;
      kernel.ve_allow_kthreads = 1&lt;br /&gt;
&lt;br /&gt;
This can be done by adding the above lines into /etc/sysctl.conf on the hardware node, and then running &amp;lt;code&amp;gt;sysctl -p&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Debian Notes =====&lt;br /&gt;
&lt;br /&gt;
Debian Etch still uses vzctl version 3.0.11 and so NFS client support is not yet available. Lenny presently has version 3.0.18.&lt;br /&gt;
&lt;br /&gt;
==== Prepare the HN ====&lt;br /&gt;
&lt;br /&gt;
For NFS mounts to work in the containers with the RHEL5-based kernels you must enable kernel threads in the container by setting &amp;lt;code&amp;gt;kernel.ve_allow_kthreads=1&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 # modprobe nfs&lt;br /&gt;
&lt;br /&gt;
You will probably want the nfs module to load automatically on reboots.  One way to do this is to put the modprobe  command in your /etc/rc.d/rc.local file:&lt;br /&gt;
&lt;br /&gt;
  modprobe nfs&lt;br /&gt;
&lt;br /&gt;
==== Prepare the container ====&lt;br /&gt;
To allow a container to use NFS filesystem, you will need to start it with &amp;quot;nfs&amp;quot; feature enabled. If the container is running while you set the &amp;lt;code&amp;gt;--features nfs:on&amp;lt;/code&amp;gt;, you will need to reboot it.&lt;br /&gt;
&lt;br /&gt;
 # vzctl set 101 --features &amp;quot;nfs:on&amp;quot; --save&lt;br /&gt;
 # vzctl start 101&lt;br /&gt;
&lt;br /&gt;
After this you may see nfs in &amp;lt;code&amp;gt;/proc/filesystems&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vzctl exec 101 cat /proc/filesystems&lt;br /&gt;
        ext3&lt;br /&gt;
        ext2&lt;br /&gt;
nodev   rpc_pipefs&lt;br /&gt;
nodev   proc&lt;br /&gt;
nodev   nfs&lt;br /&gt;
nodev   sysfs&lt;br /&gt;
nodev   tmpfs&lt;br /&gt;
nodev   devpts&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mounting NFS ===&lt;br /&gt;
Make sure that packages &amp;lt;code&amp;gt;nfs-utils&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nfs-utils-lib&amp;lt;/code&amp;gt; or similar are installed in a container.&lt;br /&gt;
&lt;br /&gt;
Assuming that you already have NFS server set up at &amp;lt;code&amp;gt;192.168.0.1:/nfs_pub&amp;lt;/code&amp;gt;, mounting will be simple&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vzctl enter 100&lt;br /&gt;
# mkdir /nfs&lt;br /&gt;
# mount -t nfs 192.168.0.1:/nfs_pub /nfs&lt;br /&gt;
# cat /proc/mounts &lt;br /&gt;
simfs / simfs rw 0 0&lt;br /&gt;
proc /proc proc rw 0 0&lt;br /&gt;
sysfs /sys sysfs rw 0 0&lt;br /&gt;
devpts /dev/pts devpts rw 0 0&lt;br /&gt;
nfs /nfs nfs rw,vers=3,rsize=32768,wsize=32768,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=192.168.0.1 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details on how to setup NFS mount, see [http://nfs.sourceforge.net/nfs-howto/ar01s04.html NFS-client HOWTO]&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
* There are quite a few parameters in NFS, so sometimes it doesn't work due to misconfiguration. We've created a separate&lt;br /&gt;
page describing such situations: [[NFS doesn't work]].&lt;br /&gt;
* Suspend and migrate operations fail if the VE has NFS partitions mounted [http://bugzilla.openvz.org/show_bug.cgi?id=616]&lt;br /&gt;
&lt;br /&gt;
== ISSUE: can't install nfs-common on ubuntu VE ==&lt;br /&gt;
&lt;br /&gt;
Host machine is ubuntu server 8.0.4 , VE container is ubuntu from openvz template repo.&lt;br /&gt;
&lt;br /&gt;
Despite following all of the above directives, I am unable to get nfs-common to install on the VE (installs fine on the host machine).&lt;br /&gt;
&lt;br /&gt;
Here is output ''(from inside VE)'' when I try to install nfs-common&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@clinton:/# apt-get install nfs-common&lt;br /&gt;
Reading package lists... Done&lt;br /&gt;
Building dependency tree       &lt;br /&gt;
Reading state information... Done&lt;br /&gt;
nfs-common is already the newest version.&lt;br /&gt;
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.&lt;br /&gt;
1 not fully installed or removed.&lt;br /&gt;
After this operation, 0B of additional disk space will be used.&lt;br /&gt;
Setting up nfs-common (1:1.1.2-2ubuntu2.2) ...&lt;br /&gt;
 * Starting NFS common utilities                                                                                                                         [fail] &lt;br /&gt;
invoke-rc.d: initscript nfs-common, action &amp;quot;start&amp;quot; failed.&lt;br /&gt;
dpkg: error processing nfs-common (--configure):&lt;br /&gt;
 subprocess post-installation script returned error exit status 1&lt;br /&gt;
Errors were encountered while processing:&lt;br /&gt;
 nfs-common&lt;br /&gt;
E: Sub-process /usr/bin/dpkg returned an error code (1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cause of this problem is that portmap is not running. Portmat must be running before installing nfs-common.&lt;br /&gt;
&lt;br /&gt;
Just run portmap:&lt;br /&gt;
&lt;br /&gt;
 # /etc/init.d/portmap start&lt;br /&gt;
&lt;br /&gt;
Then, install nfs-common:&lt;br /&gt;
&lt;br /&gt;
 # apt-get install nfs-common&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [http://nfs.sourceforge.net/nfs-howto/ar01s04.html NFS-client HOWTO]&lt;br /&gt;
[[Category: HOWTO]]&lt;/div&gt;</summary>
		<author><name>Adrimcgrady</name></author>
		
	</entry>
</feed>