Sun Cluster Data Service for NFS Guide for Solaris OS

ProcedureHow to Register and Configure Sun Cluster HA for NFS by using Sun Cluster Command Line Interface (CLI)

Before You Begin
  1. On a cluster member, become superuser or assume a role that provides solaris.cluster.admin RBAC authorization.

  2. Create the Pathprefix directory.

    Create a Pathprefix directory on the HA file system (global file system or failover file system). Sun Cluster HA for NFS resources will use this directory to maintain administrative information.

    You can specify any directory for this purpose. However, you must manually create a Pathprefix directory for each resource group that you create.

    # mkdir -p Pathprefix-directory
  3. Create a failover resource group to contain the NFS resources.

    # clresourcegroup create [-n nodelist] -p Pathprefix=Pathprefix-directory resource-group
    [-n nodelist]

    Specifies an optional, comma-separated list of physical node names or IDs that identify potential masters. The order here determines the order in which the Resource Group Manager (RGM) considers primary nodes during failover.

    -p Pathprefix=Pathprefix-directory

    Specifies a directory that resources in this resource group will use to maintain administrative information. This is the directory that you created in Step 2.


    Specifies the failover resource group.

  4. Verify that you have added all your logical hostname resources to the name service database.

    To avoid any failures because of name service lookups, verify that all IP addresses to hostname mappings that are used by Sun Cluster HA for NFS are present in the server's and client's /etc/inet/hosts file.

  5. Modify the hosts entry in /etc/nsswitch.conf so that resolving a name locally the host does not first contact NIS or DNS, but instead immediately returns a successful status.

    This modification enables HA-NFS to fail over correctly in the presence of public network failures.

    # hosts: cluster files [SUCCESS=return] nis
    # rpc: files nis
  6. (Optional) Customize the nfsd or lockd startup options.

    1. To customize nfsd options, on each cluster node open the /etc/init.d/nfs.server file, find the command-line starting with /usr/lib/nfs/nfsd, and add any additional arguments desired.

      In Solaris 10, to customize nfsd options, open the /etc/default/nfs file and edit the NFSD_SERVERS variable.

    2. To customize lockd startup options, on each cluster node open the /etc/init.d/nfs.client file, find the command line starting with/usr/lib/nfs/lockd, and add any command-line arguments desired.

      Starting with Solaris 9, you can set the lockd grace period with the LOCKD_GRACE_PERIOD parameter in the /etc/default/nfs file. However, if the grace period is set in a command-line argument in the /etc/init.d/nfs.client file, this will override the value set in LOCKD_GRACE_PERIOD.

    Note –

    The command lines must remain limited to a single line. Breaking the command line into multiple lines is not supported. The additional arguments must be valid options documented in man pages nfsd(1M) and lockd(1M).

  7. Add the desired logical hostname resources into the failover resource group.

    You must set up a logical hostname resource with this step. The logical hostname that you use with Sun Cluster HA for NFS cannot be a SharedAddress resource type.

    # clreslogicalhostname create -g resource-group -h logical-hostname, … [-N netiflist] lhresource
    -g resource-group

    Specifies the resource group that is to hold the logical hostname resources.

    -h logical-hostname, …

    Specifies the logical hostname resource to be added.

    -N netiflist

    Specifies an optional, comma-separated list that identifies the IP Networking Multipathing groups that are on each node. Each element in netiflist must be in the form of netif@node. netif can be used as an IP Networking Multipathing group name, such as sc_ipmp0. The node can be identified by the node name or node ID, such as sc_ipmp0@1 or sc_ipmp@phys-schost-1.

    Note –

    If you require a fully qualified hostname, you must specify the fully qualified name with the -h option and you cannot use the fully qualified form in the resource name.

    Note –

    Sun Cluster does not currently support using the adapter name for netif.

  8. From any cluster node, create the SUNW.nfs subdirectory.

    Create a subdirectory called SUNW.nfs below the directory that the Pathprefix property identifies in Step 3.

    # mkdir Pathprefix-directory/SUNW.nfs
  9. Create a dfstab.resource file in the SUNW.nfs directory that you created in Step 8, and set up share options.

    1. Create the Pathprefix/SUNW.nfs/dfstab.resource file.

      This file contains a set of share commands with the shared path names. The shared paths should be subdirectories on a cluster file system.

      Note –

      Choose a resource name suffix to identify the NFS resource that you plan to create (in Step 11). A good resource name refers to the task that this resource is expected to perform. For example, a name such as user-nfs-home is a good candidate for an NFS resource that shares user home directories.

    2. Set up the share options for each path that you have created to be shared.

      The format of this file is exactly the same as the format that is used in the /etc/dfs/dfstab file.

      # share -F nfs [-o specific_options] [-d “description] pathname
      -F nfs

      Identifies the file system type as nfs.

      -o specific_options

      Grants read-write access to all the clients. See the share(1M) man page for a list of options. Set the rw option for Sun Cluster.

      -d description

      Describes the file system to add.


      Identifies the file system to share.

      Note –

      If you want to share multiple paths, the above share command need to be repeated for each path that you are sharing.

    When you set up your share options, consider the following points.

    • When constructing share options, do not use the root option, and do not mix the ro and rw options.

    • Do not grant access to the hostnames on the cluster interconnect.

      Grant read and write access to all the cluster nodes and logical hosts to enable the Sun Cluster HA for NFS monitoring to do a thorough job. However, you can restrict write access to the file system or make the file system entirely read-only. If you do so, Sun Cluster HA for NFS fault monitoring can still perform monitoring without having write access.

    • If you specify a client list in the share command, include all the physical hostnames and logical hostnames that are associated with the cluster. Also include the hostnames for all the clients on all the public networks to which the cluster is connected.

    • If you use net groups in the share command (rather than names of individual hosts), add all those cluster hostnames to the appropriate net group.

    The share -o rw command grants write access to all the clients, including the hostnames that the Sun Cluster software uses. This command enables Sun Cluster HA for NFS fault monitoring to operate most efficiently. See the following man pages for details.

    • dfstab(4)

    • share(1M)

    • share_nfs(1M)

  10. Register the NFS resource type.

    # clresourcetype register resource-type

    Adds the specified resource type. For Sun Cluster HA for NFS, the resource type is SUNW.nfs.

  11. Create the NFS resource in the failover resource group.

    # clresource create -g resource-group -t resource-type resource
    -g resource-group

    Specifies the name of a previously created resource group to which this resource is to be added.

    -t resource-type

    Specifies the name of the resource type to which this resource belongs. This name must be the name of a registered resource type.


    Specifies the name of the resource to add, which you defined in Step 9. This name can be your choice but must be unique within the cluster.

    The resource is created in the enabled state.

  12. Run the clresourcegroup(1CL) command to manage the resource group.

    # clresourcegroup online -M resource-group

Example 1 Setting Up and Configuring Sun Cluster HA for NFS

The following example shows how to set up and configure Sun Cluster HA for NFS.

  1. To create a logical host resource group and specify the path to the administrative files used by NFS (Pathprefix), the following command is run.

    # clresourcegroup create -p Pathprefix=/global/nfs resource-group-1
  2. To add logical hostname resources into the logical host resource group, the following command is run.

    # clreslogicalhostname create -g resource-group-1 -h schost-1 lhresource
  3. To make the directory structure contain the Sun Cluster HA for NFS configuration files, the following command is run.

    # mkdir -p /global/nfs/SUNW.nfs
  4. To create the dfstab.resource file under the nfs/SUNW.nfs directory and set share options, the following command is run.

    # share -F nfs -o rw=engineering -d “home dirs” /global/nfs/SUNW.nfs

    Note –

    You also need to add this entry to the dfstab.resource file.

  5. To register the NFS resource type, the following command is run.

    # clresourcetype register SUNW.nfs
  6. To create the NFS resource in the resource group, the following command is run.

    # clresource create -g resource-group-1 -t SUNW.nfs r-nfs

    The resource is created in the enabled state.

  7. To enable the resources and their monitors, manage the resource group, and switch the resource group into online state, the following command is run.

    # clresourcegroup online -M resource-group-1