FSTAB(5) — FILE FORMATS
NAME
fstab − static information about filesystems
SYNOPSIS
#include <mntent.h>
DESCRIPTION
The file /etc/fstab describes the filesystems and swapping partitions used by the local machine. The system administrator can modify it with a text editor. It is read by commands that mount, unmount, dump, restore, and check the consistency of filesystems; also by the system in providing swap space. The file consists of a number of lines like this:
fsname dir type opts freq passno
for example:
/dev/xy0a / 4.2 rw,noquota 1 2
The entries from this file are accessed using the routines in getmntent(3), which returns a structure of the following form:
struct mntent {
char∗mnt_fsname;/∗ filesystem name ∗/
char∗mnt_dir;/∗ filesystem path prefix ∗/
char∗mnt_type;/∗ 4.2, nfs, swap, or ignore ∗/
char∗mnt_opts;/∗ rw, ro, noquota, quota, hard, soft ∗/
intmnt_freq;/∗ dump frequency, in days ∗/
intmnt_passno;/∗ pass number on parallel fsck ∗/
};
Fields are separated by white space; a ‘#’ as the first non-white character indicates a comment.
The mnt_type field determines how the mnt_fsname and mnt_opts fields will be interpreted. Here is a list of the filesystem types currently supported, and the way each of them interprets these fields:
4.2 mnt_fsname Must be a block special device.
mnt_optsValid options are ro, rw, quota, noquota.
NFS mnt_fsname The path on the server of the directory to be served.
mnt_optsValid options are ro, rw, quota, noquota, hard, soft.
SWAP mnt_fsname Must be a block special device swap partition.
mnt_optsIgnored.
If the mnt_type is specified as ignore then the entry is ignored. This is useful to show disk partitions not currently used.
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 determines what filesystems should be dumped). Most systems set the mnt_freq field to 1, indicating that filesystems are dumped each day.
The final field mnt_passno is used by the consistency checking program fsck(8) to allow overlapped checking of filesystems during a reboot. All filesystems with mnt_passno of 1 are checked first simultaneously, then all filesystems with mnt_passno of 2, and so on. It is usual to make the mnt_passno of the root filesystem have the value 1, and then check one filesystem on each available disk drive in each subsequent pass, until all filesystem partitions are checked.
The /etc/fstab file is read only by programs, and never written; it is the duty of the system administrator to maintain this file. The order of records in /etc/fstab is important because fsck, mount, and umount process the file sequentially; filesystems must appear after filesystems they are mounted within.
FILES
/etc/fstab
SEE ALSO
getmntent(3), fsck(8), mount(8), quotacheck(8), quotaon(8)
Sun Release 2.0 — Last change: 12 March 1985