MNTENT(5) — UNIX Programmer’s Manual
NAME
mntent, fstab − 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/xy0a / 4.3 rw,noquota 1 2
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, swap, or ignore ∗/
char∗mnt_opts;/∗ ro, quota, etc. ∗/
intmnt_freq;/∗ dump frequency, in days ∗/
intmnt_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 seperated options. Some of the options are common to all filesystem types, others only make sense for a single filesystem type. 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.
4.3
mnt_fsnameMust be a block special device.
mnt_optsValid opts are: ro, rw, suid, nosuid, quota, noquota.
NFS
mnt_fsnameThe path on the server of the directory to be served.
mnt_optsValid opts are: ro, rw, suid, nosuid, hard, soft, bg, fg, retry, rsize, wsize, timeo, retrans, port, 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 simultaneosly, 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.
FILES
/etc/fstab
SEE ALSO
fsck(8), getmntent(3), mount(8), quotacheck(8), quotaon(8), umount(8)
7th Edition — Revision 1.4 of 22/11/88