Because the generic commands work on multiple filesystem types–for example, mount can mount a bfs, sfs, vxfs, s5, or ufs filesystem among other types–they require filesystem type-specific information which can be provided explicitly on the command line or implicitly through the filesystem table /etc/vfstab.
What does the vfstab filesystem table do?
The filesystem table is an ASCII file with two functions:
- to describe the filesystems that will be mounted automatically
- to provide missing default values for the mount(1M) command for filesystems it (vfstab) lists
For each filesystem type, vfstab contains a record consisting of the following fields (separated by spaces):
special fsckdev mountp fstype fsckpass automnt mntopts
The meaning of each field is as follows:
- “special”
- The block special device for local devices or the resource name for remote filesystems (for example, nfs). (For more information on the nfs filesystem type see “Overview of NFS”.
- “fsckdev”
- The character special device that corresponds to special. The block special device is used if the character special device is not available. Use a “-” where there is no applicable device. (For example, a memfs filesystem would have a “-” for this field.)
- “mountp”
- The default mount directory (mount point).
- “fstype”
- The type of the filesystem on the special device.
- “fsckpass”
- The pass number to be used by ff, fsck, and ncheck to decide whether to check the filesystem automatically. Use “-” to inhibit automatic checking of the filesystem.
- “automnt”
- yes or no for whether the filesystem should be automatically mounted by mountall when the system is booted. If this field is yes and the filesystem is not clean, the file system will be checked with the -y option.
- “mntopts”
- A list of comma-separated options that will be used in mounting the filesystem. Use “-” to show no options. See mount(1M) for a list of the available options. Lines beginning with the # character are comments.
The /etc/vfstab File
The /etc/vfstab file, referred to as the file system table, specifies resources that should be automatically mounted when the system is booted or when the mountall command is used.
This file can be modified using any text editor. To automatically mount an NFS resource, add a line to the /etc/vfstab file that contains the appropriate options that would have been entered manually with a mount -F nfs command. To remove automatic mounting of an NFS resource, delete the appropriate line from the /etc/vfstab file.
NFS supports client-side failover. That is, if an NFS resource becomes unavailable, the client can switch to another NFS server that provides a “replicated” copy of the resource. This failover capability can be enabled by adding an entry in the /etc/vfstab for the resource. In the Device to Mount field, list the systems that provide the replicated resource separated by commas. Also, the read-only option (-o ro) is specified in the Mount Options field. For example, to provide client-side failover for the /export/local resource that is available from either the “alpha” or the “beta” NFS servers and mounted at /usr/local, add the following entry to the /etc/vfstab file:
alpha,beta:/export/local - /usr/local nfs - no -o ro
Note that read-only resources (-o ro mount option) can be configured for client-side failover. Also be certain that the system names are valid and separated by commas.