Upgrading NFS server

This document describes how to upgrade nfs-utils without trashing NFS. It assumes you have a working NFS already. Check the NFS-HOWTO or linuxsetup23.html for more details on setting up NFS.

If you ever get the urge to upgrade the NFS or rpc commands on your server, think twice. The upgrade may go smoothly or you may lose hours of time struggling to repair the system.

Upgrading

  1. Download new nfs-utils, and grab a copy of portmap (which hasn't changed in quite a while).
    nfs-utils = http://sourceforge.net/projects/nfs
    portmap = ftp.porcupine.org/pub/security
  2. Backup the following files, which should be in /usr/sbin. If installation fails, copying these files back and reboot should restore the original state.
    exportfs
    rpc.mountd
    rpc.nfsd
    rpc.statd
    nfsstat
    rpc.rquotad
    showmount
    nhfsstone
    nhfsrun
    nhfsnums
    nhfsgraph
    rpc.lockd
  3. Build nfs-utils
         tar -xzvf nfs-utils-1.0.1.tar.gz
         cd *
         configure
         make 
         make install  (as root)     
  4. Restart nfsserver
         /etc/rc.d/portmap restart
         /etc/rc.d/nfs restart
         /etc/rc.d/nfsserver restart
         
    If the startup scripts are not present, start NFS server by hand by starting the daemons in the following order:
         portmap
         rpc.mountd
         rpc.nfsd
         rpc.statd
         rpc.lockd
         rpc.quotad (optional)     
  5. Test the new server by unmounting and remounting something on a client. On the client, typing 'mount' should print a line like:
     dalek:/temporary on /temporary type nfs (rw,addr=192.168.100.2)

Checklist - if it won't start

NFS is difficult to debug because it often writes nothing to any log file. It may not even be obvious whether it is running or not.

  1. Make sure /etc/exports exists and is readable:
       ls -l /etc/exports
       -rw-r--r--    1 root     root          177 Aug  7  2001 /etc/exports
       cat /etc/exports
       /home/shared_stuff    *.my_hostname.com(rw)   
  2. Make sure the executables are running on server:
        ps -aux | grep rpc
        root       793  0.0  0.6  1768  824 ? S 17:06 0:00 /usr/sbin/rpc.mountd
        root       798  0.0  0.6  1772  804 ? S 17:06 0:00 /usr/sbin/rpc.nfsd
        ps -aux | grep nfs
        root       798  0.0  0.6  1772  804 ? S 17:06 0:00 /usr/sbin/rpc.nfsd
        ps -aux | grep portmap
        bin        389  0.0  0.4  1340  540 ? S 17:06 0:00 /sbin/portmap   
  3. Check the rpc diagnostic tools on server for clues
        /usr/sbin/rpcinfo -p localhost
        program vers proto   port
        100000    2   tcp    111  portmapper
        100000    2   udp    111  portmapper
        100005    1   udp    969  mountd
        100005    2   udp    969  mountd
        100005    1   tcp    972  mountd
        100005    2   tcp    972  mountd
        100003    2   udp   2049  nfs
        100003    2   tcp   2049  nfs
    
        /usr/sbin/showmount
        Hosts on my_samba_server:
        host1.my_hostname.com
        host2.my_hostname.com
    
        /usr/sbin/nfsstat
       Warning: /proc/net/rpc/nfsd: No such file or directory
       Server rpc stats:
       calls      badcalls   badauth    badclnt    xdrcall
       0          0          0          0          0       
       Server nfs v2:
       null       getattr    setattr    root       lookup     readlink   
       0       0% 0       0% 0       0% 0       0% 0       0% 0       0% 
       read       wrcache    write      create     remove     rename     
       0       0% 0       0% 0       0% 0       0% 0       0% 0       0% 
       [etc]
       Client rpc stats:
       [etc]
       Client nfs v3:
       [etc]
  4. Try rebooting. Sometimes the NFS server will only start at boot-up.
  5. Make sure NFS server is activated in kernel. This may require compiling a new kernel. The following need to be activated in /usr/src/linux/.config:
       # CONFIG_CODA_FS is not set
       # CONFIG_INTERMEZZO_FS is not set
       CONFIG_NFS_FS=y
       CONFIG_NFS_V3=y
       CONFIG_NFSD=y
       CONFIG_NFSD_V3=y
       CONFIG_SUNRPC=y
       CONFIG_LOCKD=y
       CONFIG_LOCKD_V4=y   
    (This is for kernel 2.5.5).
  6. As a last resort, if the daemon starts up, get its pid using 'ps' and try strace to find out what it's doing:
       # strace -f -p < pid> 2>&1 | tee /tmp/junk   

Error messages

    nfssvc: Function not implemented
This usually means when you configured the kernel, you didn't modularize or compile in support for "NFS server support". Older kernels may require enabling "experimental" before you can do this.

If the server gets a message like:
    carbon portmap[7989]: connect from 192.168.100.2 to dump():
    request from unauthorized host
add the client's IP number to /etc/hosts.allow and /etc/exports.
In hosts.allow:
    ALL : 192.168.100.2
In exports:
    /home/tjnelson          192.168.100.2(rw)
If it says:
    Cannot MOUNTPROG RPC: RPC: Program not registered  
this means the NFS server is not running.


Back