System Administration Guide: Network Services

ProcedureHow to Enable NFS Server Logging

Starting with the Solaris Express, Developer Edition 2/07 release, you can do the following:


Note –

When you use sharemgr, you do not need to use the share, shareall, and unshare commands. Also, you do not need to edit the /etc/dfs/dfstab file.


The following procedure uses the sharemgr utility. If you prefer to use the share and shareall utilities, see the example that follows this procedure.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. (Optional) Change file-system configuration settings.

    In /etc/nfs/nfslog.conf, you can change the settings in one of two ways. You can edit the default settings for all file systems by changing the data that is associated with the global tag. Alternately, you can add a new tag for this file system. If these changes are not needed, you do not need to change this file. The format of /etc/nfs/nfslog.conf is described in the nfslog.conf(4) man page.

  3. Use the sharemgr utility to assign property values to the file system to be shared by using NFS server logging.

    1. Use the following syntax to create a share group with the desired property value.


      # sharemgr create [-P protocol] [-p property=value] share-group

      For example:


      # sharemgr create -p log=global my-group
      

      This example uses the default settings associated with the global tag. Note that the tag assigned to the log property must also exist in the /etc/nfs/nfslog.conf file.

    2. Use the following syntax to add shares to the share group.


      # sharemgr add-share -s share-path [-t] [-d description] [-r resource-name] share-group
    3. (Optional) If necessary, use the following syntax to set more property values to an existing share group.


      # sharemgr set [-P protocol] [-S security-mode] [-p property=value] share-group

      For example:


      # sharemgr set -p ro=true my-group
      

      In this example the permissions for my-group are set to read-only.


      Note –

      You do not need to repeat this command-line syntax for each additional property value. You can use the -p option multiple times to define multiple properties on the same command line.


  4. Use the following syntax to verify what you have created.


    # sharemgr show [-v] [-p] [-x] [share-group...]
  5. Check if nfslogd, the NFS log daemon, is running.


    # ps -ef | grep nfslogd
    
  6. (Optional) Start nfslogd, if it is not running.


    # svcadm restart network/nfs/server:default
    

Example 5–3 How to Use the share and shareall Commands to Enable NFS Server Logging

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. (Optional) Change file-system configuration settings.

    In /etc/nfs/nfslog.conf, you can change the settings in one of two ways. You can edit the default settings for all file systems by changing the data that is associated with the global tag. Alternately, you can add a new tag for this file system. If these changes are not needed, you do not need to change this file. The format of /etc/nfs/nfslog.conf is described in nfslog.conf(4).

  3. Add entries for each file system to be shared by using NFS server logging.

    Edit /etc/dfs/dfstab. Add one entry to the file for the file system on which you are enabling NFS server logging. The tag that is used with the log=tag option must be entered in /etc/nfs/nfslog.conf. This example uses the default settings in the global tag.


    share -F nfs -o ro,log=global /export/ftp

    See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.

  4. Share the file system.

    After the entry is in /etc/dfs/dfstab, you can share the file system by either rebooting the system or by using the shareall command.


    # shareall
    
  5. Verify that the information is correct.

    Run the share command to check that the correct options are listed:


    # share
    -        /export/share/man   ro   ""
    -        /usr/src     rw=eng   ""
    -        /export/ftp    ro,log=global  ""
  6. Check if nfslogd, the NFS log daemon, is running.


    # ps -ef | grep nfslogd
    
  7. (Optional) Start nfslogd, if it is not running already.

    • (Optional) If /etc/nfs/nfslogtab is present, start the NFS log daemon by typing the following:


      # svcadm restart network/nfs/server:default
      
    • (Optional) If /etc/nfs/nfslogtab is not present, run any of the share commands to create the file and then start the daemon.


      # shareall
      # svcadm restart network/nfs/server:default