fstab(4) fstab(4)NAME fstab - static information about file systems SYNOPSIS #include <mntent.h> DESCRIPTION The file /etc/fstab describes the file systems and swapping partitions used by the local machine. It can be modified with a text editor by the system administrator. The file is read by commands that mount, unmount, and check the con- sistency of file systems; it is also read by the system in providing swap space. Because there is an appropriate mount request in the /etc/rc startup file, any file systems described in /etc/fstab (other than those of type ignore or with mount option noauto) are mounted automatically whenever multi-user mode is entered. The /etc/fstab file consists of a number of lines in the following format fsname dir type opts freq passno For example /dev/xy0a / 5.2 rw,noquota 1 2 The field freq is optionally used by dump.bsd(1M) to help report which file systems need to be dumped. passno is used by fsck(1M) to help select which file systems to check. For example, fsck -p2 checks all the 5.2 file systems listed in /etc/fstab with passno greater than or equal to 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, 5.2, nfs, swap, or ignore */ char *mnt_opts; /* rw, ro, noquota, quota, noauto, hard, soft */ int mnt_freq; /* dump frequency, in days */ int mnt_passno; /* pass # on parallel fsck */ }; Fields are separated by white space; a # as the first nonwhite character indicates a comment. April, 1990 1
fstab(4) fstab(4)The mnt_type field determines how the mnt_fsname and mnt_opts fields will be interpreted. Here is a list of the file system types currently supported, and the way each of them interprets these fields. 4.2/5.2 mnt_fsname Must be a block device. mnt_opts Valid options are ro, rw, quota, noquo- ta, noauto. NFS mnt_fsname The path on the server of the directory to be served. mnt_opts Valid options are ro, rw, quota, noquo- ta, noauto, hard, soft. SWAP mnt_fsname Must be a block device swap partition. mnt_opts Ignored. If the mnt_opts field contains noauto, the entry will be ig- nored during a mount -a command, allowing definition of fstab entries for commonly used file systems not mounted au- tomatically. If the mnt_type is specified as ignore then the entry is ig- nored. This is useful to show disk partitions not currently used. The /etc/fstab file is only read by programs and never writ- ten by them; 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; file systems must appear following the file systems they are mounted in. Note that listing a file system as type swap will not cause the system to mount the file system as a swap area; to do that, you must use the swap command. FILES /etc/fstab SEE ALSO dump.bsd(4), fsck(1M), mount(1M), swap(1M), getmntent(3). 2 April, 1990