[9]The getcwd( ) routine builds its pathname of the current working directory by searching upward via the ".." directory, and then reading each directory to find the directory with the same file ID number as the current working directory. To get the file ID requires invoking the stat( ) system call on the directory. If the directory is served by an NFS server, and the server is unavailable, then stat( ), hence getcwd( ), and the application will hang indefinitely.
[10]The example uses /users and not /home. This is because the automounter in Solaris reserves /home. While you can modify each Solaris client to remove the reservation, that is tedious. A common error is for people to use vfstab or the mount command to mount onto /home, and if the automounter has reserved /home, things will fail in odd ways.This makes it easier to deal with servers that have several filesystems of home directories. The disadvantage to this approach is that it requires a larger /etc/vfstab file, with one entry for each user's home directory. If you use the NFS automounter, this naming scheme is more easily managed than the hostname-oriented one (and the automounter has a /home/username scheme preconfigured). Directories that follow any regular naming scheme are easily managed by the automounter, as discussed in Chapter 9, "The Automounter".
Normally you don't want people running applications on hosts that are also NFS servers. However, if you allow this, and if you want users on the NFS server to be able to access the toolbox as /software/toolbox, then you can either create a symbolic link from /software/toolbox to /export/home/toolbox, or use the loopback filesystem in Solaris to accomplish the same thing without the overhead of a symbolic link:mount wahoo:/export/home/toolbox /software/toolbox
mount -F lofs /export/home/toolbox /software/toolbox
Before: single tools depository # mount toolbox:/export/home/tools /software/tools After: multiple filesystems # mount toolbox:/export/home/epubs /software/tools/epubs # mount backpack:/export/home/case /software/tools/cae
The mount command determines the architecture of the local host and grabs the correct binary directory from the server. This scheme is sufficient if you only have binaries in your local depository, but most sites add manual pages, source code, and other ASCII files that are shared across client architectures. There is no need to maintain multiple copies of these files. To accommodate a mixture of shared ASCII and binary files, use two mounts of the same filesystem: the first mount sets up the framework of directories, and puts the shared file directories in their proper place. The second mount deposits the proper binary directory on top of /usr/local/bin:On server toolbox: # cd /export/home/local # ls bin.mips bin.sun3 bin.sun4 bin.vax On client: # mount toolbox:/export/home/local/bin.`arch` /usr/local/bin
At first glance, the previous example appears to violate the NFS rules prohibiting the export of a directory and any of its subdirectories. However, there is only one exported filesystem on server toolbox, namely, /export/home. The clients mount different parts of this exported filesystem on top of one another. NFS allows a client to mount any part of an exported filesystem, on any directory. To save disk space with the two-mount approach, populate /export/home/bin on the server with the proper executables, and make the bin.arch directory a symbolic link to bin. This allows clients of the same architecture as the server to get by with only one mount. If you keep all executables -- scripts and compiled applications -- in the bin directories, you still have a problem with duplication. At some sites, scripts may account for more than half of the tools in /usr/local/bin, and having to copy them into each architecture-specific bin directory makes this solution less pleasing. A more robust solution to the problem is to divide shell scripts and executables into two directories: scripts go in /usr/local/share while compiled executables live in the familiar /usr/local/bin. This makes share a peer of the /usr/local/man and src directories, both of which contain architecture-neutral ASCII files. To adapt to the fully architecture-neutral /usr/local/bin, users need to put both /usr/local/bin and /usr/local/share in their search paths, although this is a small price to pay for the guarantee that all tools are accessible from all systems. There is one problem with mounting one filesystem on top of another: if the server for these filesystems goes down, you will not be able to unmount them until the server recovers. When you unmount a filesystem, it gets information about all of the directories above it. If the filesystem is not mounted on top of another NFS filesystem, this isn't a problem: all of the directory information is on the NFS client. However, the hierarchy of mounts used in the /usr/local/bin example presents a problem. One of the directories that an unmount operation would need to check is located on the server that crashed. An attempt to unmount the /usr/local/bin directory will hang because it tries to get information about the /usr/local mount point -- and the server for that mount point is the one that crashed. Similarly, if you try to unmount the /usr/local filesystem, this attempt will fail because the /usr/local/bin directory is in use: it has a filesystem mounted on it.On server toolbox: # cd /export/home/local # ls bin bin.mips bin.sun3 bin.sun4 bin.vax mansharesrc On client: # mount toolbox:/export/home/local /usr/local # mount toolbox:/export/home/local/bin.`arch` /usr/local/bin
6.5. Replication | 7. Network File System Design and Operation |
Copyright © 2002 O'Reilly & Associates. All rights reserved.