Article ID: 5494, created on Jul 24, 2008, last review on Jul 1, 2016

  • Applies to:
  • Virtuozzo
  • Virtuozzo containers for Linux
  • Virtuozzo hypervisor


In Virtuozzo containers for Linux 4.x, Virtuozzo hypervisor 5.0, Virtuozzo 6 and 7, you may mount an NFS share from within a container.

Let us assume we have the container #101, based on CentOS OS. The steps outlined below will allow you to mount the share named /share from the NFS server,, as /mnt from within container #101.

There are 3 versions of NFS:

  • 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.

And there are 3 corresponding kernel modules: nfs (for NFSv2), nfsv3, nfsv4.

First, for NFS mounts to work in containers, you must load the necessary module on the hardware server itself, e.g.:

# modprobe nfs

NOTE: In Virtuozzo containers for Linux 4.x, Virtuozzo hypervisor 5.0, Virtuozzo 6 the module nfs supports all 3 protocols.

Starting from Virtuozzo 7, NFS version 2 (NFSv2) is no longer supported. The module for NFSv3 or NFSv4 protocol should be loaded explicitly, e.g.:

# modprobe nfsv3

Then, to allow a container to use the NFS filesystem, you will need to start it with the nfs feature enabled:

# vzctl set 101 --features nfs:on --save
# vzctl start 101

If the container is running while you set the nfs feature, you will need to restart it:

# vzctl restart 101

After it is done, you should see nfs in the list of available filesystems inside container #101:

# vzctl exec 101 cat /proc/filesystems
nodev    rpc_pipefs
nodev    autofs
nodev    proc
nodev    sysfs
nodev    tmpfs
nodev    devpts
nodev    nfs

Next, you need to install necessary software in the container. This may be done from the hardware node, the command to install this set of packages is:

For CentOS 6:

# vzpkg install 101 -p nfs-utils nfs-utils-lib rpcbind

For CentOS 5:

# vzpkg install 101 -p nfs-utils nfs-utils-lib portmap

After that you may mount the NFS share from within container #101:

  • Start the service rpcbind:

    For CentOS 6:

    # /etc/init.d/rpcbind start

    For CentOS 5:

    # /etc/init.d/portmap start
  • Mount the NFS share:

    # mount -t nfs /mnt

If you see an error like this:

mount: mount to NFS server '' failed: RPC Error: Program not registered.

or like this:

mount.nfs: No such device

then make sure that the NFS server is running and it exports the share, and /etc/exports contain an entry for the share to be exported to the NFS client:

# /etc/init.d/nfs status
# cat /etc/exports

You may also want to make the service rpcbind (portmap) start automatically when the container is booting, using the utility chkconfig in the container:

For CentOS 6:

# chkconfig rpcbind on

For CentOS 5:

# chkconfig portmap on

And finally, you may add the nfs feature to every new container you create. This may be done using the script vps.create or vps.clone. Please refer to this article for more details.

See also

119344 NFS server support inside CentOS containers


  • Containers with NFSv4 mounts cannot be migrated in online mode
  • In Virtuozzo 7, online migration of contaienrs with NFS client is not supported yet (PSBM-47068)

Search Words


mount nfs share


nfs client

can't start nfs on the container



2897d76d56d2010f4e3a28f864d69223 0dd5b9380c7d4884d77587f3eb0fa8ef a26b38f94253cdfbf1028d72cf3a498b e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f

Email subscription for changes to this article
Save as PDF