MNTENT(5) — UNIX Programmer’s Manual
NAME
mntent − static information about filesystems
SYNOPSIS
#include <mntent.h>
DESCRIPTION
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:
fsname dir type opts freq passno
an example of which would be:
/dev/zd0a / 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;/∗ file system name ∗/
char∗mnt_dir;/∗ file system path prefix ∗/
char∗mnt_type;/∗ 4.2, nfs, swap, or ignore ∗/
char∗mnt_opts;/∗ ro, quota, etc. ∗/
intmnt_freq;/∗ dump frequency, in days ∗/
intmnt_passno;/∗ pass number on parallel fsck ∗/
};
The fields are separated by white space, and a ‘#’ as the first non-white character indicates a comment. If a field is null, you must place a period (.) there as a placeholder.
The mnt_type field determines how the mnt_fsname and mnt_opts fields are interpreted. Below is a list of the file system types currently supported and the way each of them interprets these fields.
4.2
mnt_fsnameMust be a block special device.
mnt_optsValid opts are ro, rw, quota, noquota.
NFS
mnt_fsnameThe path on the server of the directory to be served.
mnt_optsValid opts are ro, rw, quota, noquota, hard, soft, intr.
SWAP
mnt_fsnameMust be a block special device swap partition.
mnt_optsIgnored.
If the mnt_type is specified as “ignore” the entry is ignored. This is useful to show disk partitions which are currently not used.
The field mnt_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 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.
The file /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 within which they are mounted.
FILES
/etc/fstab
SEE ALSO
getmntent(3), fsck(8), mount(8), umount(8)
4BSD