Thursday, January 19, 2012

Using NFSv4 under OpenVZ

It is possible to use NFS v3 and NFS v4 under OpenVZ-based virtual hosts.

Firstly, you have to enable FEATURES="nfs" on the VM definition.. That was the easy bit.

NFS now appears to work on the surface, but locks, stats, and id mapping seems to be bust.
Looking at verbose logs, it turns out that certain files are missing from /proc/net/rpc/ on the VMs.

The key to making things work is to edit /etc/default/nfs-common on the host server(s) and set


And then run /etc/init.d/nfs-common restart

Now remount your NFS shares in the guest machines, and you'll discover the idmapping and stuff is working..

The downside to all this is that the username-to-UID mapping is done on the host server, not the guests -- which is essentially useless :(