Introduction
This page describes AlexisHuxley's experiences running:
Analysis
To my knowledge there are three NFS implementations for Linux. Each of them exhibits some problems running in an OpenVz virtual machine:
Debian package name |
problems |
nfs-kernel-server |
requires patching kernel; see http://wiki.openvz.org/NFS_server_inside_VE |
nfs-user-server |
no locking, file size limited to 2GB |
unfs3 |
no locking, lchown() not implemented |
For my own personal use, being able to read and write files of sizes larger than 2GB was essential so I had to go with the unfs3. This meant I had to contend with the following problems:
rdiff-backup seems to be one of the few programs needing lchown()
- when the automounter invokes mount and umount then it wants to write to /etc/mtab, which on a VE is a symlink to a read-only 'file' under /proc; although mount and umount can be told not to write to this file, there is no convenient way to get the automounter to relay this request to them
the Debian automounter package suffers from bug whereby the mountpoints are removed as the autmounter exits and they are not recreated when it is next started.
Procedure
- On the server install the unfs3 package.
- On the clients install the nfs-common package.
On the HN add the following to /etc/modules:
autofs4 nfs
(The HN may not be the NFS server, so it would not load these modules and VEs don't have the power to load modules.)Ensure all VE clients mount the server with the -nolock option.
To work around the disappearing mountpoints edit /etc/init.d/autofs, locate the line:
: echo LOCALOPTIONS $localoptions
and immediately after it add:
mkdir -p $dir
To get the automounter to invoke mount and umount with the -n option so as to not write to /etc/fstab, run:
dpkg-divert --add --rename /bin/mount dpkg-divert --add --rename /bin/umount cat > /bin/mount <<'EOF' #!/bin/sh if [ "X$MOUNT_MTAB" = Xfalse -a $(/usr/bin/basename $0) = mount ]; then exec $0.distrib -n "$@" elif [ "X$MOUNT_MTAB" = Xfalse -a $(/usr/bin/basename $0) = umount ]; then exec $0.distrib -in "$@" else exec $0.distrib "$@" fi EOF chmod 755 /bin/mount ln -f /bin/mount /bin/umount echo "export MOUNT_MTAB=false" >> /etc/default/autofsand restart the automounter.- Be sure that the portmapper is started automatically at boot-time on the client and server.
To fix rdiff-backup, see GettingRdiffBackupWorkingOnUnfs3.
