2

I have an Ubuntu 11.10 VPS running inside OPenVZ with a hosting company. I'm trying to get it to mount a remote NFS server using NFS4, but can only get it working using version 3. I've been Googling around this quite a lot and occasionally I'll read something along of the lines of "NFS4 clients can't work inside OpenVZ containers". I can't find an up-to-date concrete answer to this so I'll ask here:

Is this true, and if so, great - then I can stop trying to get this to work! But if it IS possible, why's it not working?? Here's what I've done --

  • nfs-common installed on client, nfs-kernel-server installed on server
  • saw some instructions to install nfs-utils on client, but apt-get can't find the package
  • mount from client to server works successfully with NFS vers 3
  • server seems to be working fine; can mount successfully using NFSv4 from an Ubuntu VM running on my desktop
  • BUT on the successful client machine nfs AND nfs4 is listed in /proc/filesystems, on the problematic one it's only nfs
  • I logged a ticket and the relevant module's now been installed on the VPS node, according to the engineer responsible. He's replied that it should now be working but I think he may have just re-enabled the "standard" NFS module (see above re: cat /proc/filesystems | grep nfs)

    $ sudo mount -v -t nfs4 [SERVER_IP]:/ /NFS-ARCHIVE/ mount.nfs4: pinging: prog 100003 vers 4 prot tcp port 2049 mount.nfs4: No such device

    $ sudo mount.nfs [SERVER_IP]:/ /NFS-ARCHIVE/ -w -n -o nfs4 mount.nfs: Unsupported nfs mount option: nfs4

  • I've read that I might need to manually load the module by running modprobe nfs before mounting, but I don't think I can do that on a VPS. sudo modprobe -l on the client returns nothing

Any help much appreciated, especially if you can categorically answer the first question - at least if I know it's impossible I can then move onto setting everything up using vers 3!

1
  • In case anyone from the future finds this question: I continued reading up on the issue but couldn't get a solid answer stating whether NFS4 was supported in OpenVZ based VMs. But I did come across this great post, which explained some VPS basics for me, the most useful of which was that Xen-based VMs, while maybe not quite as well-performing as OpenVZ-based ones, should allow you to load kernel modules at will. I switched over to a Xen container and had no problem getting NFS4 (and bonus: ufw) working easily
    – Mark G
    Mar 9, 2012 at 19:33

3 Answers 3

1

Later versions of OpenVZ do support NFS4 in container. We are using the latest CentOS 6.2 together with the latest stable OpenVZ release 2.6.32-042stab053.5 and NFS4 do work well for us.

1

While NFS 4 clients do work in an OpenVZ VPS (tested with Proxmox 2.1) if the feature nfs:on is enabled and the nfs module is loaded on the host (i.e. container 0), the name -> UID lookups are always done using the rpc.idmapd running on the host. This means that you need to have the same users in your host /etc/passwd as in your VPS.

Furthermore, the default mount option sec=sys permissions don't work right if the UIDs/GIDs numbers don't match between your VPS, host and server! One would expect that with nfs3 (since it sends UID/GID numbers over the wire), but with nfs4 the username/groupnames are sent. See http://thread.gmane.org/gmane.linux.nfsv4/7103/focus=7105 (and answer to RHEL - NFS4: Mounted/Exported as rw, user write permission denied) for more details.

The upshot is you can mount nfs4 inside a VPS with sec=sys provided

  1. You have a new enough openVZ kernel.

  2. You have enough control over the host and VPS setup to

    • enable the nfs:on option for the nfs4 client VPS
    • load the nfs module on the host
    • run the rpc.idmapd daemon on the host
    • control the /etc/passwd entries on the host
  3. You can live with the limitations implied by having to share VPS/host usernames.

It may be possible to set up something more flexible using kerberos/ldap or perhaps even if there is a way to control the idmapd domain used for the mount, but I have no experience with those options.

0

The VPS itself has to have the feature nfs:on enabled. Ask your hosting company to enable that.

You can find more information on the Wiki: http://wiki.openvz.org/NFS

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .