Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 57 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
57
Dung lượng
241 KB
Nội dung
6 NFS 6-13 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 Configuring the NFS File Server To set up an NFS server, complete the following steps: 1. Edit the /etc/dfs/dfstab file and add those file resources to be automatically shared whenever the system enters run level 3. For example: share -F nfs /usr/share/man 2. Start the NFS server daemons by invoking the following: # /etc/init.d/nfs.server start This shares the contents of the /etc/dfs/dfstab file. Note – You can use the dfshares command to verify that the resources are available. 6 6-14 Solaris™ 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 NFS Informational Commands Use the following commands to get information about NFS resources. The dfshares Command The dfshares command displays the NFS resources currently being shared. Command Format dfshares [ -F nfs ] [ host ] Without arguments, the dfshares command displays shared resources for the local server. # dfshares RESOURCE SERVER ACCESS TRANSPORT host1:/usr/share/man host1 - - It is also used to display shared resources by a specified server name. # dfshares host2 RESOURCE SERVER ACCESS TRANSPORT host2:/export host2 - - 6 NFS 6-15 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 The dfmounts Command This command displays mounted resource information. Command Format dfmounts [ -F nfs ] Without arguments, the dfmounts command displays the shared resource and clients mounting the resource for the local server. # dfmounts RESOURCE SERVER PATHNAME CLIENTS - host1 /usr/share/man host5,host9 This command is also used to display mounted resource information for a specified server name. # dfmounts host2 RESOURCE SERVER PATHNAME CLIENTS - host2 /export host5,host9 6 6-16 Solaris™ 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 The NFS Client The following commands and files are used with the NFS client. The mount Command The /usr/sbin/mount command is used to attach either a local or remote file resource to the file system hierarchy. Command Format mount [ -F nfs ] [ -o options ] server:pathname mount_point Options The following options can be used with the mount command: ● -F nfs Specifies nfs as the file system type. This option is not required because nfs is the default remote file system type. ● -o options Specifies a comma-separated list of file-system specific options, such as rw, to mount the file resource as read, write, and ro to mount the file resource read-only. (The default is rw.) ● server:pathname Specifies the name of the server and the path name of the remote file resource; these are separated by a colon (:). ● mount_point Specifies the path name of the mount point on the local system (which must already exist). 6 NFS 6-17 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 Accessing a Remote File Resource Use the mount command to access a remote file resource. For example: # mount host1:/usr/share/man /usr/share/man To mount a remote read-only file resource from the first-available host in a comma-separated list of hosts, execute the following: # mount -o ro host1,host2,host3:/usr/share/man /usr/share/man For file systems shared as read-only, if multiple hosts are named and the first server in the list is down, the failover utility uses an alternative server in the list to access files. The /etc/vfstab File To have remote file resources mounted at boot time, enter the appropriate entries in the client’s /etc/vfstab file. For example: #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # host1:/usr/share/man - /usr/share/man nfs - yes soft,bg The fields in the /etc/vfstab file include: ● device to mount The name of the server and the path name of the remote file resource; these are separated by a colon (:). ● device to fsck NFS resources are not checked from the client, because the file system is not owned by the client. This field is always dash (-) for NFS resources. ● mount point The default mount point for the file resource. ● FS type Use nfs for NFS resources. 6 6-18 Solaris™ 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 ● fsck pass NFS resources are not checked from the client, because the file system is not owned by the client. This field is always dash (-) for NFS resources. ● mount at boot Either yes or no, which indicates whether the file resource should be mounted when the system enters run level 2 or when the mountall command is issued, respectively. ● mount options A comma-separated list of mount options. ● rw |ro Specifies whether the resource is mounted as read write or read only. The default is read write. ● bg| fg If the first mount attempt fails, retry in the background or foreground. The default is to retry in the foreground. ● soft| hard During an NFS mount request, the soft option returns an error if the server does not respond, then it continues boot. The hard option continues to retry the mount until the server responds or the retry/timeout values are exceeded. The default is a hard mount. Note – Although soft or bg are not the default settings, combining these two options usually results in the fastest client boot up when NFS mounting problems arise. ● intr |nointr Indicates keyboard interrupts to kill a process that is hung waiting for a response on a hard-mounted file system. The default is intr. 6 NFS 6-19 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 ● suid |nosuid Indicates whether to enable setuid execution. The default enables setuid execution. ● timeo= n Sets timeout to n tenths of a second. The default timeout is 11, measured in one-tenth of a seconds (0.1 second) for User Datagram Protocol (UDP) transports and 600 tenths of a second for TCP. ● retry= n Sets the number of times to retry the mount operation. The default is 10,000 times. ● retrans= n Sets the number of NFS retransmissions to n . The default is 5 for UDP. For connection-oriented transports (such as TCP), this option has no effect. Note – If the file resource is listed in the /etc/vfstab file, the superuser can specify either server:pathname or mount_point on the command line because the mount command checks the /etc/vfstab file for more information. 6 6-20 Solaris™ 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 Recommended Mounting Options Mounting a file system with the bg option indicates that if the server's mountd does not respond, the system's attempt to remount the file system occurs in the background. This prevents the remount from interruptions of other system services. When the file system is mounted, an NFS request waits the amount of time indicated by the timeo field (tenths of a second) for a response. If no response is received, the value in the timeo field is doubled and the request is retried. When the retransmission times reach the value in the retrans field, a file system mounted with the soft option returns an error. A file system mounted with the hard option prints a warning message and continues to retry. Table 6-1 lists the recommended mounting options for some commonly shared file resources. A Read-Only Directory The /usr file system contains operating system binaries. This essential file system is mounted in the foreground, the booting process does not continue until the mount is completed. The NFS client hard mounts this directory. This means the client continues to retry the mount request until the server responds. Table 6-1 Mount Options NFS File Resource Read-write/ Read-only System Startup Server Crash Interrupt Security /usr ro fg hard nointr suid /export/home rw bg hard intr nosuid /opt/frame ro bg soft — nosuid 6 NFS 6-21 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 A Read-Write Directory The /export/home directory is where the users’ login directories are commonly placed. A hard mount is recommended for all read-write (rw) file systems (for example, users’ home directories). The nosuid option provides additional network security because the setuid permissions on NFS resources are ignored. A Read-Only Application Directory Nonessential applications are commonly mounted as read only (ro)in the background (bg) with a soft mount. The system continues to boot if the server does not respond during boot. If the server crashes, the mount times out. The umount Command Use the /usr/sbin/umount command to detach either a local or remote file resource from the file system hierarchy. Command Format umount server:pathname | mount_point The command line can specify either server:pathname or mount_point . # umount /usr/share/man 6 6-22 Solaris™ 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services September 2000, Revision A.1 The mountall and umountall Commands Use the /usr/sbin/mountall and /usr/sbin/umountall commands to mount and unmount all file resources. The mountall Command Without any arguments, the /usr/sbin/mountall command mounts all file resources listed in the /etc/vfstab file with a mount-at-boot value of yes. To limit the action of this command to remote file resources, use the -r option. Command Format mountall -r [ -F nfs ] The -F nfs option restricts the action of this command to NFS resources only. # mountall -r [...]... discussed in this module: q System Administration Guide, Volume I, Sun Part Number 80 5-72 28- 10 q System Administration Guide, Volume II, Sun Part Number 80 5-7229-10 q System Administration Guide, Volume III, Sun Part Number 80 6-0916-10 7-1 Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 7 AutoFS Overview The AutoFS file system enables you to do... the system enters run level 3 host1:/usr/share/man - /usr/share/man nfs - yes ro,bg 6- 24 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 6 NFS Server Logging A new feature in the Solaris 8 Operating Environment is NFS server logging This feature records NFS reads and writes on the file system. .. NFS Client 4 Rename the /usr/share/man directory so that you can no longer access the manual pages installed on the client system Verify that the man pages are unavailable What message does the man command report? No manual entry for ls 5 Create a new man directory for use as a mount point # mkdir man 6 -42 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc... 6- 38 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 6 On the NFS Client 4 Rename the /usr/share/man directory so that you can no longer access the manual pages installed on the client system Verify that the man pages are unavailable # cd /usr/share # mv man man.orig # man ls What message... ls Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 6 Exercise Summary Discussion – Take a few minutes to discuss the experiences, issues, or discoveries that you had during the lab exercises q Experiences q Interpretations q Conclusions q Applications NFS 6 -41 Copyright 2000 Sun Microsystems,... /usr/lib/nfs/nfslogd /usr/lib/nfs/statd /usr/lib/nfs/lockd Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 6 Troubleshooting NFS Errors You can discover most NFS problems through console messages or symptoms on a client rpcbind Failure Error Error Message nfs mount: server1:: RPC: Rpcbind failure... buffer=buffers/workbuffer You must create the directories for logs, fh, and buffers before starting NFS server logging 6- 28 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 6 In this example, any file system shared with log=publicftp uses the following values: q The default directory is /var/nfs q The log... Message No such file or directory This message is displayed during the boot process or in response to an explicit mount request and indicates an unknown file resource name on the server Solution Complete the following step: 1 Check that the directory exists on the server and is spelled correctly on the command line or in the /etc/vfstab file 6-36 Solaris 8 Operating Environment System Administration II. .. automatically occurs q q 7-2 Centralize the administration of AutoFS mounts through the use of a name service Have multiple mount resources for read-write file systems Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc All Rights Reserved Enterprise Services September 2000, Revision A.1 ... bring the system down to the single-user mode from run level 3, the who -r command might be disabled Rebooting the system re-enables the command 2 Use the ps -e command on the server to see if the mount daemon is running If it is not, start it by invoking the /etc/init.d/nfs.server script first with a stop flag and then with a start flag 3 Check or verify your /etc/dfstab entries 6- 34 Solaris 8 Operating . required, because nfs is the default remote file system type. 6 6- 24 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise. command to verify that the resources are available. 6 6- 14 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services. log=nfslog fhtable=fhtable buffer=nfslog_workbuffer 6 6- 28 Solaris 8 Operating Environment System Administration II Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services