Whole document tree
11. Examples
11.1 User FilesystemsWith more than one fileserver, the directories most frequently cross-mounted are those containing user home directories. A common convention used at Imperial College is to mount the user disks under /home/machine. Typically, the `/etc/fstab' file contained a long list of entries such as:
for each fileserver on the network. There are numerous problems with this system. The mount list can become quite large and some of the machines may be down when a system is booted. When a new fileserver is installed, `/etc/fstab' must be updated on every machine, the mount directory created and the filesystem mounted. In many environments most people use the same few workstations, but it is convenient to go to a colleague's machine and access your own files. When a server goes down, it can cause a process on a client machine to hang. By minimizing the mounted filesystems to only include those actively being used, there is less chance that a filesystem will be mounted when a server goes down. The following is a short extract from a map taken from a research fileserver at Imperial College. Note the entry for `localhost' which is used for users such as the operator (`opr') who have a home directory on most machine as `/home/localhost/opr'.
This map is shared by most of the machines listed so on those systems any of the user disks is accessible via a consistent name. Amd is started with the following command
Note that when mounting a remote filesystem, the automounted mount point is referenced, so that the filesystem will be mounted if it is not yet (at the time the remote `mountd' obtains the file handle).
11.2 Home DirectoriesOne convention for home directories is to locate them in `/homes' so user `jsp''s home directory is `/homes/jsp'. With more than a single fileserver it is convenient to spread user files across several machines. All that is required is a mount-map which converts login names to an automounted directory. Such a map might be started by the command:
where the map `amd.homes' contained the entries:
Whenever a login name is accessed in `/homes' a symbolic link appears pointing to the real location of that user's home directory. In this example, `/homes/jsp' would appear to be a symbolic link pointing to `/home/charm/jsp'. Of course, `/home' would also be an automount point. This system causes an extra level of symbolic links to be used. Although that turns out to be relatively inexpensive, an alternative is to directly mount the required filesystems in the `/homes' map. The required map is simple, but long, and its creation is best automated. The entry for `jsp' could be:
This map can become quite big if it contains a large number of entries. By combining two other features of Amd it can be greatly simplified. First the UFS partitions should be mounted under the control of `/etc/fstab', taking care that they are mounted in the same place that Amd would have automounted them. In most cases this would be something like `/a/host/home/host' and `/etc/fstab' on host `charm' would have a line:
The map can then be changed to:
This map operates as usual on a remote machine (ie
11.3 Architecture SharingOften a filesystem will be shared by machines of different architectures. Separate trees can be maintained for the executable images for each architecture, but it may be more convenient to have a shared tree, with distinct subdirectories. A shared tree might have the following structure on the fileserver (called `fserver' in the example):
In this example, the subdirectories of `local/tex/bin' should be hidden when accessed via the automount point (conventionally `/vol'). A mount-map for `/vol' to achieve this would look like:
When `/vol/tex/bin' is referenced, the current machine architecture
is automatically appended to the path by the
11.4 Wildcard Names & Replicated ServersBy using the wildcard facility, Amd can overlay an existing directory with additional entries. The system files are usually mounted under `/usr'. If instead, Amd is mounted on `/usr', additional names can be overlayed to augment or replace names in the "master" `/usr'. A map to do this would have the form:
Note that the assignment to In this example, it is assumed that the `/usr' files are replicated on three fileservers: `fserv1', `fserv2' and `fserv3'. For any references other than to `local' and `share' one of the servers is used and a symbolic link to ${autodir}/${rhost}/export/exec/${arch}/whatever is returned once an appropriate filesystem has been mounted.
11.5 `rwho' serversThe `/usr/spool/rwho' directory is a good candidate for automounting. For efficiency reasons it is best to capture the rwho data on a small number of machines and then mount that information onto a large number of clients. The data written into the rwho files is byte order dependent so only servers with the correct byte ordering can be used by a client:
11.6 `/vol'`/vol' is used as a catch-all for volumes which do not have other conventional names. Below is part of the `/vol' map for the domain `doc.ic.ac.uk'. The `r+d' tree is used for new or experimental software that needs to be available everywhere without installing it on all the fileservers. Users wishing to try out the new software then simply include `/vol/r+d/{bin,ucb}' in their path. The main tree resides on one host `gould.doc.ic.ac.uk', which has different `bin', `etc', `lib' and `ucb' sub-directories for each machine architecture. For example, `/vol/r+d/bin' for a Sun-4 would be stored in the sub-directory `bin/sun4' of the filesystem `/usr/r+d'. When it was accessed a symbolic link pointing to `/a/gould/usr/r+d/bin/sun4' would be returned.
11.7 `/defaults' with selectorsIt is sometimes useful to have different defaults for a given map. To achieve this, the `/defaults' entry must be able to process normal selectors. This feature is turned on by setting `selectors_in_defaults = yes' in the `amd.conf' file. See section 6.5.32 selectors_in_defaults Parameter. In this example, I set different default NFS mount options for hosts which are running over a slower network link. By setting a smaller size for the NFS read and write buffer sizes, you can greatly improve remote file service performance.
11.8 `/tftpboot' in a chroot-ed environmentIn this complex example, we attempt to run an Amd process inside a chroot-ed environment. `tftpd' (Trivial FTP) is used to trivially retrieve files used to boot X-Terminals, Network Printers, Network routers, diskless workstations, and other such devices. For security reasons, `tftpd' (and also `ftpd') processes are run using the chroot(2) system call. This provides an environment for these processes, where access to any files outside the directory where the chroot-ed process runs is denied. For example, if you start `tftpd' on your system with
then the `tftpd' process will not be able to access any files outside `/tftpboot'. This ensures that no one can retrieve files such as `/etc/passwd' and run password crackers on it. Since the TFTP service works by broadcast, it is necessary to have at least one TFTP server running on each subnet. If you have lots of files that you need to make available for `tftp', and many subnets, it could take significant amounts of disk space on each host serving them. A solution we implemented at Columbia University was to have every host run `tftpd', but have those servers retrieve the boot files from two replicated servers. Those replicated servers have special partitions dedicated to the many network boot files. We start Amd as follows:
That is, Amd is serving the directory `/tftpboot/.amd'. The `tftp' server runs inside `/tftpboot' and is chroot-ed in that directory too. The `amd.tftpboot' map looks like:
To help understand this example, I list a few of the file entries that are created inside `/tftpboot':
Here is an explanation of each of the entries listed above:
This document was generated by Philippe Troin on March, 20 2002 using texi2html |