Mounting nfs share in a vserver environment
Yesterday i had a problem while building a debian package for a piece of software which is running on several servers in our company: it should mount nfs shares. So, where’s the problem, you ask? The problem is that i was building and testing it on our sandbox vserver. And i spent about half an hour to figure out that the problem was not in the nfs configs, but in that i am running it all in a vserver environment. Googling, i found 2 solutions:
- you mount needed shares on a host sever on which vserver boxes run directly to needed vserver root. it could be rather easily implemented by parsing <vserver-root>/etc/fstab and mounting shares for example when starting vserver. The other side of the coin is that the one who needs to mount nfs share is needed access to host server, which is often unacceptable;
- on linux.vserver mailing list Matthieu says:
Hello,I’m using NFS mounts with success in vservers from about 4 months.
1 - Using kernelspace nfsd
2 - Lauching portmap/nfs-clients daemons on the main server
3 - when starting the vserver, doing :
chbind –ip–bcast - working greatchroot
${VSERVERS_ROOT}/${VSERVER_NAME} mount -t nfs
:/partage/nfs/pro /mnt/pro
So it let me just happy with the fact that the problem has the solution. But it’s really annoying, and i migrated to a partially-sandbox server, but a real host without vservers, to continue building tests and actually build the package.