Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4042637
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

分类: LINUX

2007-06-27 16:45:41

AIX

You can stop and start most NFS daemons either by using commands or by using SMIT, which ultimately calls SRC commands. The exceptions are rpc.rexd, rpc.ruserd, rpc.rwalld, and rpc.rsprayd, which are started by inetd. The following subsystems are part of the nfs group: nfsd, biod, rpc.lockd, rpc.statd, and rpc.mountd.

To start the nfs group, type:

# -g nfs

This starts all of the daemons of the nfs group as well as the appropriate number of each. For nfsd and biod the default number of daemons is eight. To change these defaults, you must do one of the following:

  1. Run the command.
  2. Run the chnfs command, for example:

    # -n4 -b4

  3. Run the chssys command, for example:

    # -s biod -a6

The chnfs command stops currently running nfsds and biods, updates the database to reflect the new defaults (in this case four daemons each), and then restarts the daemons using commands. The chssys command changes the cmdargs descriptor in a subsystem definition, in this case the biod subsystem. Therefore anytime you run the following command:

# startsrc -s biod

the value of the -a parameter is used to determine the number of biods to start, in this case six. You can start any subsystem with the startsrc -s command or stop one with the -s command. For example:

# startsrc -s rpc.lockd
# stopsrc -s rpc.mountd

The file that controls the NFS (and NIS for that matter) daemons on startup is . To disable NFS upon bootup, either remove the line containing that file name from the file or run the smit rmnfs command and select restart in the STOP NFS now, system restart or both field. To enable NFS upon bootup it is best to use the command because it is easy to make a syntax error trying to edit /etc/inittab by hand.

Note that /etc/rc.nfs controls the startup of both NFS and NIS. If you want to disable NIS but not NFS you can comment out the appropriate lines in /etc/rc.nfs or run smit rm or . Do not remove the rcnfs line in /etc/inittab if you want only to disable NIS.

To configure an NFS server in AIX, all you do is create an file and then run smit mknfs. You can use a text editor to create /etc/exports or you can do the following:

  1. Run SMIT:

    #

  2. You will see the following:


    Add a Directory to Exports List

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.

    [Entry Fields]
    * PATHNAME of directory to export [] /
    * MODE to export directory read-write +
    HOSTNAME list. If exported read-mostly []
    Anonymous UID [-2]
    HOSTS allowed root access []
    HOSTS & NETGROUPS allowed client access []
    Use SECURE option? no +
    * EXPORT directory now, system restart or both both +
    PATHNAME of Exports file if using HA-NFS []

The required entries are PATHNAME of directory to export, MODE to export directory, and EXPORT directory now, system restart or both. Fill in these parameters and press Enter. SMIT will create or update the file and then run the -a command. The other parameters are optional and can be determined by consulting the exports man page. Run the smit chnfs command.

To start the NFS daemons,

  1. Run SMIT:

    #

  2. You will see the following:


    Start NFS

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.
    [Entry Fields]
    * START NFS now, on system restart or both both +

Pressing Enter at this point starts all the daemons of the nfs group and puts an entry in the file to make the changes permanent.

You can use the same procedure as above, run smit mknfs to start the NFS daemons-and in the case of an NFS client the biods are the only ones you might want-or you can simply start making NFS mounts from a server by doing the following:

  1. Start SMIT:

    #

  2. You will see the following:

    Add a File System for Mounting

    Type or select values in entry fields.
    Press Enter AFTER making all desired changes.

    [Entry Fields]
    * PATHNAME of mount point [] /
    * PATHNAME of remote directory []
    * HOST where remote directory resides []
    Mount type NAME []
    * Use SECURE mount option? no +
    * MOUNT now, add entry to or both? now +
    * /etc/filesystems entry will mount the directory no +
    on system RESTART.
    * MODE for this NFS file system read-write +
    * ATTEMPT mount in foreground or background background +
    NUMBER of times to attempt mount [] #
    Buffer SIZE for read [] #
    Buffer SIZE for writes [] #
    NFS TIMEOUT. In tenths of a second [] #
    Internet port NUMBER for server [] #
    * Mount file system soft or hard hard +
    Allow keyboard INTERRUPTS on hard mounts? yes +
    Minimum TIME, in seconds, for holding [3] #
    attribute cache after file modification
    Maximum TIME, in seconds, for holding [60] #
    attribute cache after file modification
    Minimum TIME, in seconds, for holding [30] #
    attribute cache after directory modification
    Maximum TIME, in seconds, for holding [60] #
    attribute cache after directory modification
    Minimum & Maximum TIME, in seconds, for [] #
    holding attribute cache after any modification
    The Maximum NUMBER of biod daemons allowed [6] #
    to work on this file system
    * Allow execution of SUID and sgid programs yes +
    in this file system?
    * Allow DEVICE access via this mount? yes +
    * Server supports long DEVICE NUMBERS? yes +

The required entries are denoted by the asterisk (*), are fairly obvious, and have default values which you will in most cases prefer. However, a couple entries need some additional explanation. For MOUNT now, add entry to or both? the default value is now. If you accept the default, SMIT will make the mount, but the mount will be in effect only until system restart or until you explicitly unmount the file system with the command. Selecting the value of both will not only result in the mount but also an entry in the /etc/filesystems file.

As explained in the chapter on disks and file systems, /etc/filesystems is AIX's equivalent to HP-UX's file, which determines which file systems are mounted on bootup. Both files will mount networked file systems as well as local ones; the only difference is their format. If, for example, you mounted the file system /doc from the machine elmo and had an entry for that mount in /etc/filesystems, that entry would look something like:

/doc:
dev = "/doc"
vfs = nfs
nodename = elmo
mount = false
options = bg,hard,intr
account = false

This example also illustrates the other entry in the mknfsmnt screen which needs a little explanation: /etc/filesystems entry will mount the directory on system RESTART. The default value is no, which results in a mount=false line in /etc/filesystems, like in the one above. This means that the remote file system will not be mounted by default upon system restart. If the line reads mount=true, then the system will attempt to make the NFS mount upon system restart. If it cannot because the server is unavailable, then additional mount requests will occur in the background (options=bg denotes this). In some cases it is better to have the mount parameter be false. If, for example, you have several mounts from the same server and it is down, the boot process will not be bogged down by attempting to make remote mounts for each networked file system, in which case it might be better to have an /etc/rc.local file to complete the mounts once everything else is up and running.

For additional information on the options available in making NFS s, see the mount, mknfsmnt, and filesystems man pages.

Remove an entry from the file:

#

Change an exported file system:

#

Remove an NFS mount:

# smit rmnfsmnt

The basic configuration steps are listed below and detailed in the sections that follow.

  1. Configure the nodes for NFS if they are not already configured.
  2. Create the master map file.
  3. Create the map files.
  4. If you will be using NIS to administer the maps, integrate the maps with NIS.
  5. Start automounter.

Configure for NFS

Configure the systems for NFS if you have not already done so.

Create the Master Map

The master map is usually created as /etc/auto.master and then made into the NIS map auto.master. By default, automount tries to get master map information from the NIS map auto.master. If a local master map file is specified on the command line, automount reads it before reading the NIS auto.master map.

The format of the auto.master file is:

DirectoryPath AutomountMapName

where:

  • DirectoryPath is the full pathname of the directory that triggers automount.
  • AutomountMapName is the file that contains the map information.

Create Maps

Automount maps are usually named auto.xxx, where xxx is the name of the map. The name does not have to correspond to any mount points, but it is recommended that the map name correspond to the directory contents (for example, auto.man for man pages).

As with all NIS maps, names must be 10 characters or less if you have file systems that do not allow file names longer than 14 characters. This is because NIS adds four-character suffixes (.dir and .pag) to the map name.

The format of the map entries is:

key [-mount options] server:directory

where:

  • key is the name of the subdirectory under the mount directory.
  • mount options can be any valid NFS mount options. This field is optional. Mount options specified here override any mount options specified in the master map.
  • server:directory specifies the remote server name and the path of the remote file hierarchy (file system or directory) to mount.

Automount recognizes special characters in direct and indirect maps to be used for substitutions and to escape other characters. They are:

&can substitute key values into the directory path names
*is recognized as a catch all entry (a wildcard). It is the last or only entry in a map. It matches all keys and provides a value for the & substitutions that may exist in the right-hand side of a map. For example: * -ro,intr server:/users/&
+ mapnameThe contents of another map can be included within the current map. If mapname is a directory with no slashes, automount interprets it as an NIS map. If the directory has slashes then automount looks for a local map with that name.

Integrate with NIS

Automount maps can be local files or administered as NIS maps. By default, automount tries to read master map information from the NIS map auto.master. Automount also reads master map information from a local file if you specify one on the command line.

The master map can contain NIS map names for the indirect and direct maps instead of file names. To specify an NIS map, preface the map name with a plus (+).

To create an NIS map, edit the /var/yp/Makefile:

  1. Add auto.master to the all: listing.
  2. Add an entry for $(DIR)/auto.master.
  3. Add the following stanza to Makefile:
    auto.master.time: $(DIR)/auto.master
    -@if [ -f $(DIR)/auto.master ]; then \
    $(MAKEDBM) $(DIR)/auto.master $(YPDBDIR)/$(DOM)/auto.master; \
    touch auto.master.time; \
    if [ ! $(NOPUSH) ]; then \
    $(YPPUSH) auto.master; \
    echo "pushed auto.master"; \
    else \
    : ; \
    fi \
    else \
    echo "couldn't find $(DIR)/auto.master"; \
    fi
  4. Build the map:

    # cd /var/yp
    # auto.master

Start Automounter

The full pathname in AIX is /usr/sbin/automount. The options found in the automount man page are the same as those for the HP-UX version. You can also start automount by typing the t command. If you want to start automount on bootup, the best place to put it is at the end of the file, something you will have to do manually since SMIT doesn't do it for you.

Shutting Down Automount

Automount is normally started and stopped only when the machine is rebooted. To shut down automount gracefully during system operation, take the following steps:

  1. Make sure no processes have their current working directory set to any automount directories or subdirectories.
  2. Then, send automount the SIGTERM (-15) signal (SIGTERM is the default signal sent by the command).

CAUTION: No other automount daemon should be started until the first has successfully cleaned up and exited. If a second automount daemon is started when the first is in its shutdown process, the second daemon will start its shutdown process. This means that there will now be four automount daemons: the first, the second, and their children. These daemons will not exit until all the mount directories they are serving have been unmounted.

Do not send the SIGKILL signal (kill -9, kill -KILL) to the automount daemon. This will cause any processes accessing mount directories served by automount to hang. The file hierarchies mounted by automount under /tmp_mnt will still be accessible.

HP-UX

At the SAM Main window, highlight Networking/Communications and activate the OPEN button.

  1. At the Networking/Communications window, highlight Networked File Systems (NFS) and activate the OPEN button.
  2. Highlight Remote File Systems Mounted and activate the OPEN button. This edits your file.
  3. To add remote directories to be mounted, choose Add from the Actions menu and then enter the information about the remote directory you want to mount to.
    • Enter the Remote System Name. This is the system name where the directory or file you wish to access resides.
    • Enter the Remote Directory Name. This is the name of the directory you wish to access.
    • Enter the Local Directory Name. This is the local directory where you want the remote directory to be mounted.
    • Choose when to mount. You have two mount options to choose from: Now and On Boot. If Now is chosen, the directory will be available when the information in this window has been accepted. If On Boot is chosen, the directory will be available when this system is booted.
    • Choose Access Permissions. Write protection provides the type of access the user will have on the remote directory. There are two options to choose from: Read-Only, meaning the user can only read the information in the directory and Read/Write, meaning the user can read and write to the directory.
    • Set User ID execution. This indicates whether the user must have a user ID when trying to access the remote directory. Choosing Yes means a user ID is not required.
    • Change Default Mount Options. This takes you into the NFS Mount Options window. You can change the following mount options:
      • Choose one of the mount options. There are two choices: Hard mounted directories or files cause NFS to retry a request until the server responds. Soft mounted directories or files abort requests after one attempt.
      • Read Buffer Size (rsize). This specifies the maximum read request size used in communicating with the server.
      • Write Buffer Size (wsize). This specifies the maximum write request size used in communicating with the server.
  4. When you are finished entering mount information, activate the OK button to perform the task and return to the Add Remote Directory window.
  5. When you are finished entering the remote directory information, activate the OK button to add this remote directory information to your file.
  6. In the Remote File Systems Mounted window, you can enable the NFS client by choosing Enable NFS client from the Actions menu. You should see the remote directory information displayed in the window.

  1. At the Networking/Communications window, highlight Networked File Systems (NFS) and activate the OPEN button.
  2. Highlight Local File Systems Exported and activate the OPEN button. This edits your file.
  3. To add local directories that can be exported to remote systems, choose Add from the Actions menu and then enter the information about the directory you want to export to the remote systems. This will take you into the Add File System to Export window.
    • Enter the Local Directory Name. This the directory that will be exported to remote systems.
    • Enter an Unknown Userid. You can map anonymous, or unknown, user requests to uid. By setting the anonymous user ID in /etc/exports, the unknown user in an anonymous request is mapped to a well-known local user. If the anonymous user is mapped to nobody (the default), anonymous requests are accepted but have very few permissions to access files on the server. The information you need to complete this task is the remote system names to which you are allowing or denying access. If you specify uid for unknown user, you will be prompted for a login name.
    • Select asynchronous writes. Yes means that asynchronous write will be done. No means no asynchronous writes will be done.
    • Specify Permission for File Access. Selecting read only will cause the Read Only Access window to be displayed. The window enables you to add, modify or remove remote systems to have read-only access to your local directory. Selecting read/write will cause the Read/Write Access window to be displayed. This window enables you to add, modify or remove remote systems to have read/write access to your local directory.
  4. In the Local File Systems Exported window, you can enable the NFS server by choosing Enable NFS server from the Actions menu. You should see the local directories and the directories access information displayed in the window.

Using SAM to Allow or Deny Access to Specific RPC services

This task lets you allow or deny access to specific RPC services (servers). When you perform this task, you are editing the file. The information you need to complete this task is the remote system names to which you are allowing or denying access.

To perform this task:

  1. At the Networking/Communications window, highlight Security and activate the OPEN button.
  2. Highlight Internet Service and activate the OPEN button.
  3. To modify RPC services, highlight the RPC services you want to modify, or you can choose to modify all Internet Services from the Actions menu. This will take you into the Modify Internet Security window. Select the system permissions you would like your RPC services to have.
  4. When you have completed your task, activate the OK button.

You must be superuser to create an NFS server. To create an NFS server, complete the following steps. These steps are described in detail in the sections that follow.

  1. Edit .
  2. Edit (optional).
  3. Edit /usr/adm/inetd.sec (optional).
  4. Edit (optional).
  5. Create and edit .
  6. Reboot the system (if necessary) or run /etc/netnfsrc.

Edit

The /etc/netnfsrc file activates the NFS daemons and servers. To define the node as an NFS server, set the NFS_SERVER variable to any digit other than zero. Set START_MOUNTD to any digit other than 0. mountd can be started from netnfsrc on inetd. If mountd has an entry in inetd.conf the START_MOUNTD should be 0. If the node is also a client, you may want to set the NFS_CLIENT variable to any digit other than zero now. If the node is also a server for PC-NFS requests, set the PCNFS_SERVER variable to any digit other than zero.

Client Only NFS_CLIENT=1 NFS_SERVER=0
Server Only NFS_CLIENT=0 NFS_SERVER=1 START_MOUNTD=1
Both Client and Server NFS_CLIENT=1 NFS_SERVER=1 START_MOUNTD=1
Neither Client nor Server NFS_CLIENT=0 NFS_SERVER=0
PC-NFS Server PCNFS_SERVER=1 START_MOUNTD=1

You can refer directly to the comments for editing instructions and for descriptions of each activity executed by :

#!/bin/sh
## Configured using SAM by root on Tue Jul 18 14:41:23 1995
## @(#)netnfsrc: $Revision: 1.51.109.9 $ $Date: 92/08/18 13:48:27 $
# netnfsrc -- NFS startup file
##
# Depending on the configuration parameters you set within,
# this script sets up some or all of the following:
# NIS specific:
# domainname -- the NIS domain name
#
# and starts up some or all of the following programs:
# portmap -- RPC (program_#,version) -> port_# mapper
# nfsd -- NFS daemons
# biod -- async BIO daemons
# pcnfsd -- PC-NFS daemon
# NIS specific:
# ypbind -- NIS client process (all NIS nodes)
# ypserv -- NIS server process (NIS server only)
# yppasswdd -- NIS password daemon (NIS master server only)
##
# NFS_CLIENT -- 1 if this node is an NFS client, 0 if not
# NFS_SERVER -- 1 if this node is an NFS server, 0 if not
# Note: it is possible for one host to be a client, a server, both
# NFS_SERVER -- 1 if this node is an NFS server, 0 if not
# Note: it is possible for one host to be a client, a server, both
# or neither! This system is an NFS client if you will be
# NFS mounting remote file systems; this system is a server
# if you will be exporting file systems to remote hosts.
# See Also: nfsd(1M), mount(1M).
##
NFS_CLIENT=1
NFS_SERVER=1
##
# START_MOUNTD -- 1 if this script should start rpc.mountd.
# 0 if /etc/inetd.conf has an entry for mountd.
# Note: rpc.mountd should be started from netnfsrc. However, it
# can be started from either netnfsrc or inetd, and
# MUST only be configured in one place.
##
START_MOUNTD=1
##
. . .

##
#PCNFS_SERVER -- 1 if this node is a server for PC-NFS requests.
# This variable controls the startup of the
# pcnfsd(1M) server. See Also: pcnfsd(1M).
##
PCNFS_SERVER=0

Edit (optional)

To activate the RPC services, remove all # comment marks from /etc/inetd.conf lines beginning with #rpc. After editing /etc/inetd.conf, you must reconfigure inetd by entering:

-c

RPC Services Security

The inetd security facility works only when the inetd executes a server. For the RPC services that do not exit after each service request, inetd provides a security check only for the first request. Successive requests bypass the inetd and are subject only to the security checking performed by the individual RPC services. However, you can make the inetd perform a security check for every RPC request by doing both of the following steps:

  1. Add the -e option to the entry for the RPC service.
  2. Specify the RPC service in the first field of .

NOTE: Adding the -e option makes the RPC server respond slower since it has to restart for each request.

Example

Suppose contains the following:

rpc dgram udp wait root /usr/etc/rpc.mountd 100005 1 rpc.mountd -e

The rpc.mountd program is the server for the command and reads to see what the available directories or files are and to whom they are exported. It also keeps a list of all mounted directories or files. The -e option forces inetd to perform a security check for rpc.mountd on every request.

Edit (optional)

NFS operates under the assumption you have a friendly network; meaning, you can trust all users attached to your network. Since this assumption may not apply to everyone, refer to the following sections to improve your file security.

The configuration file is provided in the ARPA Services product. It is not solely for NFS access. This file allows you to determine:

  • How many remote services can run simultaneously on the local host.
  • Which hosts are allowed to remotely use the local host.
Set Maximum Number of Remote Connections

On the first line in , enter the maximum number of simultaneous remote services to be started by inetd as shown in the following example:

MAXNUM number

If you do not specify a MAXNUM value, the default is 1000.

Specify Accesses to Services

Each entry in has the following format (enter either allow or deny):

service_name allow/deny host_specifier(s)

Where:

service_name Name of a valid service (include RPC services) with an entry in /etc/inetd.conf/etc/inetd.conf

For RPC services, service_name is the name of the service that matches its program number in /etc/rpc. This entry must have a corresponding entry in /etc/inetd.conf/etc/inetd.conf which contains the -e option.

Specify only one service per entry.

If an entry in /usr/adm/inetd.conf specifies the service name and nothing else, inetd allows all hosts to attempt access.

allow/denyThe allow entry instructs inetd to approve the host or network for access to the specified service.

The deny entry instructs inetd to disapprove the host or network for access to the specified service.

host_specifier(s) Name of a host or a network listed in /etc/hosts/etc/hosts or /etc/networks, or an internet address in the standard internet notation.

You can specify more than one host or network by separating each host_specifier with a blank or tab.

You can use the asterisk (*) or dash (-) in any field of a network or host address.

You cannot use aliases.

Edit (optional)

The /etc/netgroup file enables you to define a specific network-wide group of nodes as a netgroup. You can then limit directory access by exporting directories or files (via and exportfs) to the netgroups defined. The system uses /etc/netgroup to verify host names whenever clients perform remote mounts.

Create and Edit

You make the directories or files and their access restrictions, if any, available by your entries in the server's /etc/exports file. When you boot up the NFS server, the file will automatically run the exportfs daemon, which looks up /etc/exports and makes the directories or files available for NFS clients to access. You can export and unexport directories or files after the server is up or change access permissions of the exported directory by using the exportfs command. The exportfs command can be run at any time by the superuser to alter the list or characteristics of exported directories and filenames. For details on constructing the /etc/exports file, see the man page on exports(4). Also refer to exportfs(1M).

Reboot

After you finish the configuration procedure, execute or reboot the system to activate the daemons and servers. The rebooting process does not unmount any of the server's directories or files that were remotely mounted by other network nodes. However, these nodes will not be able to access any of the server's files until the server is operating again.

The basic configuration steps are listed below and detailed in the sections that follow.

  1. Configure the nodes for NFS if they are not already configured.
  2. Create the master map file.
  3. Create the map files.
  4. If you will be using NIS to administer the maps, integrate the maps with NIS.
  5. Start automounter.

Configure for NFS

Configure the systems for NFS if you have not already done so. This task includes adding NFS to the kernel and editing . On the servers, edit .

Create the Master Map

The master map contains the names of the indirect and direct maps. It also contains the names of common mount directories for indirect maps. You do not need a master map if you pass all the map information to automount in the command line.

The master map is usually created as /etc/auto.master and then made into the NIS map auto.master. By default, automount tries to get master map information from the NIS map auto.master. If a local master map file is specified on the command line, automount reads it before reading the NIS auto.master map.

The format for indirect map entries in the master maps is:

mount directory indirect map [-mount options]

The format for direct map entries in the master map is:

/- direct map [-mount options]

where:

  • mount directory is the absolute path of the mount directory for the indirect map. Automount manages this directory. The directory should not be an existing directory, if a local directory by the same name already exists, automount will cover it.
  • /- indicates that the entry is for a direct map.
  • indirect map or direct map is the file name or NIS map name of the indirect map or direct map. If the map name is prefaced with a plus (+), automount searches for an NIS map. This field can also be one of the following special maps:
-hostsIndicates the hosts map. The name of the remote host is used as the subdirectory name under the mount directory.
-passwordIndicates the password map
-nullCancels a previous map for the indicated mount directory. For example, if you use this in a local master map, it cancels the entry in the NIS auto.master map.

  • mount options can be any NFS mount options. Mount options in the master map are overridden by mount options in the indirect/direct maps.

Create Map Files

Automount maps are usually named auto.xxx, where xxx is the name of the map. The name does not have to correspond to any mount points, but it is recommended that the map name correspond to the directory contents (for example, auto.man for man pages).

As with all NIS maps, names must be 10 characters or less if you have file systems that do not allow file names longer than 14 characters. This is because NIS adds four-character suffixes (.dir and .pag) to the map name.

By convention, maps are usually created under or /etc. If you use NIS to administer the maps, you should create the source files under the (1m) source directory; the default ypmake source directory is /etc.

Indirect Maps

Each indirect map has a mount directory associated with it that is controlled by automount. The mount directory contains symbolic links to the actual mount points under /tmp_mnt. The mount directory is specified on the automount command line or in the master map.

The format of the indirect map entries is:

key [-mount options] server:directory

where:

  • key is the name of the subdirectory under the mount directory.
  • mount options can be any valid NFS mount options. This field is optional. Mount options specified here override any mount options specified in the master map.
  • server:directory specifies the remote server name and the path of the remote file hierarchy (file system or directory) to mount.

Automount recognizes special characters in direct and indirect maps to be used for substitutions and to escape other characters. They are:

&can substitute key values into the directory path names
*is recognized as a catch-all entry (a wildcard). It is the last or only entry in a map. It matches all keys and provides a value for the & substitutions that may exist in the right-hand side of a map. For example: * -ro,intr server:/users/&
+ mapnameThe contents of another map can be included within the current map. If mapname is a directory with no slashes, automount interprets it as an NIS map. If the directory has slashes then automount looks for a local map with that name.

Direct Maps

Direct maps can contain any number of unrelated mount points. No common mount directory is maintained.

The format of the direct map entries is:

key [-mount options] server:directory

where:

  • key is the absolute path of the mount point.
  • mount options can be any valid NFS mount options. This field is optional. Mount options specified here override any mount options specified in the master map.
  • server:directory specifies the remote server name and the path of the remote file hierarchy (file system or directory) to mount.

The special characters listed above are also valid for direct maps.

Integrate with NIS

Automount maps can be local files or administered as NIS maps. By default, automount tries to read master map information from the NIS map auto.master. Automount also reads master map information from a local file if you specify one on the command line.

The master map can contain NIS map names for the indirect and direct maps instead of file names. To specify an NIS map, preface the map name with a plus (+).

To create NIS maps, edit the /usr/etc/yp/ shell script as shown below. In the following text, assume that you want to create NIS maps for auto.master and a direct map called auto.xxxx. Within the scripts, auto_master and auto_direct are used for local variable names to avoid regular expression evaluation, but the map and file names are auto.master and auto.direct.

Under the function section, add the following blocks for auto.master and auto.xxxx:

     auto_master() {
grep -v "^[ ]*#" $1 | grep -v "^[ ]*$" | \
awk 'BEGIN { OFS="\t"; } { print $1, $2, $3 }' | \
$MAKEDBM - $MAPDIR/auto.master
}

auto_xxxx() {
grep -v "^[ ]*#" $1 | grep -v "^[ ]*$" | \
awk 'BEGIN { OFS="\t"; } { print $1, $2, $3 }' | \}
$MAKEDBM - $MAPDIR/auto.xxxx
}

In the block

         for ARG in $*; do
case "$ARG" in

add an entry for auto.master and auto.xxxx before the "*)" in the case statement as follows:

         auto_master )
if [ `expr "$MAPS" : ".* auto.master.*"` -eq 0 ]; then
MAPS="$MAPS auto.master"
fi;;
auto_xxxx )
if [ `expr "$MAPS" : ".* auto.xxxx.*"` -eq 0 ]; then
MAPS="$MAPS auto.xxxx"
fi;;

In the definition for

      MAPS=${MAPS:-'passwd groups hosts ...

add an entry for auto_master and auto_xxxx.

In the block

     for MAP in $MAPS; do
case $MAP in

add an entry for auto.master and auto.xxxx as follows:

     auto_master)   build $DIR/auto.master auto.master ;;
auto_xxxx) build $DIR/auto.xxxx auto.xxxx;;

You should also modify /usr/etc/yp/ on the master server. Add auto.master and auto.xxxx to the list of MASTER_MAPS.

Start Automounter

Automount is started by executing /usr/etc/automount at boot time. It is executed by default from the 2 file. You can specify map information on the command line. Any map information you specify is read before information in the NIS map auto.master and takes precedence over the NIS map. See automount(1m) for specific command line options.

Shutting Down Automount

Automount is normally started and stopped only when the machine is rebooted. To shut down automount gracefully during system operation, take the following steps:

  1. Make sure no processes have their current working directory set to any automount directories or subdirectories.
  2. Then, send automount the SIGTERM (-15) signal (SIGTERM is the default signal sent by the command).

WARNING: No other automount daemon should be started until the first has successfully cleaned up and exited. If a second automount daemon is started when the first is in its shutdown process, the second daemon will start its shutdown process. This means that there will now be four automount daemons: the first, the second, and their children. These daemons will not exit until all the mount directories they are serving have been unmounted

Do not send the SIGKILL signal (kill -9, kill -KILL) to the automount daemon. This will cause any processes accessing mount directories served by automount to hang. The file hierarchies mounted by automount under /tmp_mnt will still be accessible.

Summary

NFS, originally a Sun product, works mostly the same in both AIX and HP-UX. However, some of the details differ, as always. AIX controls NFS daemons through the System Resource Controller () while HP-UX allows for direct commands. Both operating systems' system management tools (SMIT and SAM) support NFS configuration, which in most cases is the preferred way to go. Automatic NFS mounts on bootup are controlled by (AIX) and (HP-UX). Though the format of each file differs, the principle in each is the same.

Both systems support automount, though you have to configure it manually on each. The biggest difference in the automount area is its integration with NIS. Otherwise, NFS has the same "look and feel" across AIX and HP-UX platforms. Both platforms export file systems listed in via the exportfs command. Both systems have nfsds, biods, rpc.mountd, rpc.lockd, and rpc.statd. Since NFS uses the External Data Representation (XDR) protocol, there is no problem in data representation across the two systems.

阅读(4842) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~