NFS Administration Guide

Setting Up NFS Services

This section discusses some of the tasks necessary to initialize or use NFS services.

How to Start the NFS Services

    To enable daemons without rebooting, become superuser and type the following command.


    # /etc/init.d/nfs.server start
    

    This starts the daemons if there is an entry in /etc/dfs/dfstab.

How to Stop the NFS Services

    To disable daemons without rebooting, become superuser and type the following command.


    # /etc/init.d/nfs.server stop
    

How to Disable Large Files on an NFS Server

  1. Check to be sure no large files exist on the file system.

    Here is an example of a command that you can run to locate large files:


    # cd /export/home1
    # find . -xdev -size +2000000 -exec ls -l {} \;
    

    If there are large files on the file system, you must remove or move them to another file system.

  2. Unmount the file system.


    # umount /export/home1
    
  3. Reset the file system state if the file system has been mounted using -largefiles.

    fsck resets the file system state if no large files exist on the file system:


    # fsck /export/home1
    
  4. Mount the file system using -nolargefiles.


    # mount -F ufs -o nolargefiles /export/home1
    

    You can do this from the command line, but to make the option more permanent, add an entry like the following into /etc/vfstab:


    /dev/dsk/c0t3d0s1 /dev/rdsk/c0t3d0s1 /export/home1  ufs  2  yes  nolargefiles

    Note -

    Previous versions of the Solaris operating environment cannot use large files. Check to be sure clients of the NFS server are running at least version 2.6 if the clients need to access large files.


How to Use Client-Side Failover

    On the NFS client, mount the file system using the -ro option.

    You can do this from the command line, through the automounter, or by adding an entry to /etc/vfstab that looks like:


    bee,wasp:/export/share/local  -  /usr/local  nfs  -  no  -o ro

    This syntax has been allowed by the automounter in earlier releases, but the failover was not available while file systems were mounted, only when a server was being selected.


    Note -

    Servers that are running different versions of the NFS protocol can not be mixed using a command line or in a vfstab entry. Mixing servers supporting NFS V2 and V3 protocols can only be done with autofs, in which case the best subset of version 2 or version 3 servers is used.


How to Disable Mount Access for One Client

  1. Edit /etc/dfs/dfstab.

    The first example allows mount access to all clients in the eng netgroup except the host named rose. The second example allows mount access to all clients in the eng.sun.com DNS domain except for rose.


    share -F nfs -o ro=-rose:eng /export/share/man
    share -F nfs -o ro=-rose:.eng.sun.com /export/share/man

    For additional information on access lists, see "Setting Access Lists With the share Command".

  2. Run the shareall command.

    The NFS server does not use changes to /etc/dfs/dfstab until the file systems are shared again or until the server is rebooted.


    # shareall

How to Mount an NFS File System Through a Firewall

  1. Become superuser.

  2. Manually mount the file system, using a command like:


    # mount -F nfs -o public bee:/export/share/local /mnt
    

    In this example the file system /export/share/local is mounted on the local client using the public file handle. An NFS URL can be used instead of the standard pathname. If the public file handle is not supported by the server bee, the mount operation will fail.


    Note -

    This procedure requires that the file system on the NFS server be shared using the public option and any firewalls between the client and the server allow TCP connections on port 2049. Starting with the 2.6 release, all file systems that are shared allow for public file handle access.


How to Mount an NFS File System Using an NFS URL

  1. Become superuser.

  2. Manually mount the file system, using a command such as:


    # mount -F nfs nfs://bee:3000/export/share/local /mnt
    

    In this example, the /export/share/local file system is being mounted from the server bee using NFS port number 3000. The port number is not required and by default uses the standard NFS port number of 2049. You can include the public option with an NFS URL, if you want. Without the public option, the MOUNT protocol is used if the public file handle is not supported by the server. The public option will force the use of the public file handle, and the mount will fail if the public file handle is not supported.