Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Network Services
Previous Next

Automatic File-System Sharing

Servers provide access to their file systems by sharing the file systems over the NFS environment. Note the following:

  • Previously, you would specify which file systems are to be shared with the share command or with the /etc/dfs/dfstab file.

    Entries in the /etc/dfs/dfstab file are shared automatically whenever you start NFS server operation. You should set up automatic sharing if you need to share the same set of file systems on a regular basis. For example, if your computer is a server that supports home directories, you need to make the home directories available at all times. Most file-system sharing should be done automatically. The only time that manual sharing should occur is during testing or troubleshooting.

    The dfstab file lists all the file systems that your server shares with its clients. This file also controls which clients can mount a file system. You can modify dfstab to add or delete a file system or change the way sharing occurs. Just edit the file with any text editor that is supported (such as vi). The next time that the computer enters run level 3, the system reads the updated dfstab to determine which file systems should be shared automatically.

    Each line in the dfstab file consists of a share command, the same command that you type at the command-line prompt to share the file system. The share command is located in /usr/sbin.

  • Starting in the Solaris Express, Developer Edition 2/07 release, you can use the sharemgr and sharectl utilities to manage file systems and file-sharing protocols. For more information, see 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.


Table 5-1 File-System Sharing Task Map

Task

Description

For Instructions

Establish automatic file-system sharing

Steps to configure a server so that file systems are automatically shared when the server is rebooted


Note - The procedure shows you how to use the sharemgr command. The example that follows the procedure uses the share and shareall commands to complete the same task.


How to Set Up Automatic File-System Sharing

Enable WebNFS

Steps to configure a server so that users can access files by using WebNFS


Note - The procedure shows you how to use the sharemgr command. The example that follows the procedure uses the share and shareall commands to complete the same task.


How to Enable WebNFS Access

Enable NFS server logging

Steps to configure a server so that NFS logging is run on selected file systems


Note - The procedure shows you how to use the sharemgr command. The example that follows the procedure uses the share and shareall commands to complete the same task.


How to Enable NFS Server Logging

How to Set Up Automatic File-System Sharing

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

  • Use the sharemgr utility to share file systems, set property values for the shared file systems, and perform related tasks. For information about sharemgr, including descriptions of subcommands and properties, see the sharemgr(1M) man page and sharemgr Command.

  • Use the sharectl utility to configure file-sharing protocols, such as NFS. See the sharectl(1M) man page and sharectl Command.


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. Note that whether you use sharemgr or share and shareall, you must set up your autofs maps so that clients can access the file systems that you have shared on the server.

  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. Use the sharemgr utility to assign property values to the file system to be shared.
    1. Use the following syntax to create a share group with the desired property value.
      # sharemgr create [-P protocol] [-p property=value] share-group
    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

      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.


  3. Use the sharemgr utility to verify what you have created by using the following syntax.
    # sharemgr show [-v] [-p] [-x] [share-group...]
Example 5-1 How to Use the share and shareall Commands to Set Up Automatic File-System Sharing
  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. Add entries for each file system to be shared.

    Edit /etc/dfs/dfstab. Add one entry to the file for every file system that you want to be automatically shared. Each entry must be on a line by itself in the file and use this syntax:

    share [-F nfs] [-o specific-options] [-d description] pathname

    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.

  3. 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
  4. 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,public  ""
See Also

Whether you use sharemgr or share and shareall, the next step is to set up your autofs maps so that clients can access the file systems that you have shared on the server. See Task Overview for Autofs Administration.

How to Enable WebNFS Access

Note the following:

  • Starting with the Solaris 2.6 release, by default all file systems that are available for NFS mounting are automatically available for WebNFS access. The only condition that requires the use of this procedure is one of the following:

    • To allow NFS mounting on a server that does not currently allow NFS mounting

    • To reset the public file handle to shorten NFS URLs by using the public option with the share command

    • To force a specific HTML file to be loaded by using the index option with the share command

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

    • Use the sharemgr utility to share file systems, set property values for the shared file systems, and perform related tasks. For information about sharemgr, including descriptions of subcommands and properties, see the sharemgr(1M) man page and sharemgr Command.

    • Use the sharectl utility to configure file-sharing protocols, such as NFS. See the sharectl(1M) man page and sharectl Command.


    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.


See Planning for WebNFS Access for a list of issues to consider before starting the WebNFS service.

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. Use the sharemgr utility to assign property values to the file system to be shared by the WebNFS service.
    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:

      • To create a share group that forces a specific HTML file to be loaded, you can use the index property:

        # sharemgr create [-P protocol] -p index=[file-path.html] share-group
      • To create a share group that moves the location of the public file handle from root (/) to an exported directory for WebNFS-enabled browsers and clients, you can use the following:

        # sharemgr set -P nfs -p public=true -s share-path share-group

        Note that the public property moves the location of a public file handle from root (/) to an exported directory for WebNFS-enabled browsers and clients. However, only one file system (or share) on each server can use this property. Because a share-group can consist of more than one file system, this property is not accepted by a share group. For more information, see the share_nfs(1M) man page.

    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

      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.


  3. Use the sharemgr utility to verify what you have created.
    # sharemgr show [-v] [-p] [-x] [share-group...]
Example 5-2 How to Use the share and shareall Commands to Enable WebNFS Access
  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. Add entries for each file system to be shared by using the WebNFS service.

    Edit /etc/dfs/dfstab. Add one entry to the file for every file system. The public and index tags that are shown in the following example are optional.

    share -F nfs -o ro,public,index=index.html /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.

  3. 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
  4. 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,public,index=index.html  ""

How to Enable NFS Server Logging

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

  • Use the sharemgr utility to share file systems, set property values for the shared file systems, and perform related tasks. For information about sharemgr, including descriptions of subcommands and properties, see the sharemgr(1M) man page and sharemgr Command.

  • Use the sharectl utility to configure file-sharing protocols, such as NFS. See the sharectl(1M) man page and sharectl Command.


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
Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire