The file /etc/fstab describes the file systems and swapping partitions used by the local machine. It is created by the system administrator using a text editor, and processed by commands which mount, unmount, check consistency of, dump and restore file systems, and by the system in providing swap space.
It consists of a number of lines of the form:
an example of which would be:
The entries in this file are accessed using the routines in getmntent(3), which returns a structure of the following form:
struct mntent { char *mnt_fsname; /* file system name */ char *mnt_dir; /* file system path prefix */ char *mnt_type; /* 4.3, nfs, dos, macintosh, cfs, or ignore */ char *mnt_opts; /* ro, etc. */ int mnt_freq; /* dump frequency, in days */ int mnt_passno; /* pass number on parallel fsck */ };
There is one entry per line in the file, and the fields are separated by white space. A ``#'' as the first non-white character indicates a comment.
The mnt_opts field consists of a string of comma separated options. Some of the options are common to all filesystem types, and others only make sense for a single filesystem type. It is important to specify that a removable filesystem (such as floppy disk) is removable, or ro if a filesystem is read-only. See mount(8) for a more complete description of the options available.
The mnt_type field determines how the mnt_fsname, and mnt_opts fields will be interpreted. Below is a list of the file system types currently supported and the way each of them interprets these fields. See /NextDeveloper/Headers/bsd/mntent.h for additional, though unsupported, file system types.
4.3
nfs
dos
NOTE: This file system does not support SCSI hard disks, CD-ROMs, or 2.88 MB floppies; it supports only 720KB and 1.4 MB floppies. To mount a dos volume, the appropriate loadable kernel server must already be loaded into the system.
macintosh
NOTE: To mount a macintosh volume, the appropriate loadable kernel server must already be loaded into the system.
cfs (CD-ROM file system)
NOTE: To mount a cfs volume, the appropriate loadable kernel server must already be loaded into the system.
If the mnt_type is specified as ``ignore'' the entry is ignored. This is useful to show disk partitions which are currently not used. Disks that are specified as as ``ignore'' are also not automounted by the Workspace in NEXTSTEP. This is useful when your disk has data in a format that NEXTSTEP doesn't recognize, and you want it to ignore the disk.
The field mnt_freq indicates how often each partition should be dumped by the dump(8) command (and triggers that command's w option which tells which file systems should be dumped). Most systems set the mnt_freq field to 1, indicating that the file systems are dumped each day.
The final field mnt_passno is used by the disk consistency check program fsck(8) to allow overlapped checking of file systems during a reboot. All file systems with mnt_passno of 1 are first checked simultaneously, then all file systems with mnt_passno of 2, and so on. It is usual to make the mnt_passno of the root file system have the value 1, and then check one file system on each available disk drive in each subsequent pass to the exhaustion of file system partitions.
/etc/fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. The order of records in /etc/fstab is important because fsck, mount, and umount process the file sequentially; file systems must appear after file systems they are mounted within.