FSTAB(5) — System Interface Manual — File Formats
NAME
fstab − static information about the filesystems
SYNOPSIS
#include <fstab.h>
DESCRIPTION
The file /etc/fstab describes the file systems and swapping partitions on 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:
fs_spec:fs_file:fs_type:fs_freq:fs_passno
an example of which would be:
/dev/xy0a:/:rw:1:1
The entries from this file are accessed using the routines in getfsent(3), which returns a structure of the following form:
struct fstab {
char∗fs_spec;/∗ block special device name ∗/
char∗fs_file;/∗ file system path prefix ∗/
char∗fs_type;/∗ rw,ro,sw or xx ∗/
intfs_freq;/∗ dump frequency, in days ∗/
intfs_passno;/∗ pass number on parallel dump ∗/
};
The lines in the file give for each file system or swap area on the local machine the disk partition it is contained in fs_spec and the directory on which it is to be mounted (unless it is a swap area) in fs_file. The fs_spec special file name is the block special file name, and not the character special file name which the rest of the entry refers to. If a program needs the character special file name, the program must create it by appending a “r” after the last “/” in the special file name.
The fs_type indicates whether it it to be read-only “ro”, readable and writable “rw”, or readable and writable subject to quotas “rq”. If fs_type is “sw” then the special file is made available as a piece of swap space by the swapon(8) command at the end of the system reboot procedure. The fields other than fs_spec and fs_type are not used in this case. If fs_type is “rq” then at boot time the file system is automatically processed by the quotacheck(8) command and disk quotas are then enabled with quotaon(8). File system quotas are maintained in a file “quotas”, which is located at the root of the associated file system. If fs_type is specified as “xx” the entry is ignored. This is useful to show disk partitions which are currently not used.
The field fs_freq indicates how often each partition should be dumped by the dump(8) command (and triggers that commands w option which tells which file systems should be dumped). Most systems set the fs_freq field to 1 indicating that the file systems are dumped each day.
The final field fs_passno is used by the disk consistency check program fsck(8) to allow overapped checking of file systems during a reboot. All file systems with fs_passno of 1 are first checked simultaneosly, then all file systems with fs_passno of 2, and so on. It is usual to make the fs_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.
FILES
/etc/fstab
SEE ALSO
getfsent(3), quotacheck(8), quotaon(8)
Sun System Release 1.0 — 18 September 1983