1.\" Copyright (c) 1980, 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 33.\" 34.Dd June 5, 1993 35.Dt FSTAB 5 36.Os BSD 4 37.Sh NAME 38.Nm fstab 39.Nd static information about the filesystems 40.Sh SYNOPSIS 41.Fd #include <fstab.h> 42.Sh DESCRIPTION 43The file 44.Nm fstab 45contains descriptive information about the various file 46systems. 47.Nm fstab 48is only read by programs, and not written; 49it is the duty of the system administrator to properly create 50and maintain this file. 51Each filesystem is described on a separate line; 52fields on each line are separated by tabs or spaces. 53The order of records in 54.Nm fstab 55is important because 56.Xr fsck 8 , 57.Xr mount 8 , 58and 59.Xr umount 8 60sequentially iterate through 61.Nm fstab 62doing their thing. 63.Pp 64The first field, 65.Pq Fa fs_spec , 66describes the block special device or 67remote filesystem to be mounted. 68For filesystems of type 69.Em ufs , 70the special file name is the block special file name, 71and not the character special file name. 72If a program needs the character special file name, 73the program must create it by appending a ``r'' after the 74last ``/'' in the special file name. 75.Pp 76The second field, 77.Pq Fa fs_file , 78describes the mount point for the filesystem. 79For swap partitions, this field should be specified as ``none''. 80.Pp 81The third field, 82.Pq Fa fs_vfstype , 83describes the type of the filesystem. 84The system currently supports four types of filesystems: 85.Bl -tag -width indent -offset indent 86.It Em ufs 87a local 88.Tn UNIX 89filesystem 90.It Em mfs 91a local memory-based 92.Tn UNIX 93filesystem 94.It Em nfs 95a Sun Microsystems compatible ``Network File System'' 96.It Em swap 97a disk partition to be used for swapping 98.El 99.Pp 100The fourth field, 101.Pq Fa fs_mntops , 102describes the mount options associated with the filesystem. 103It is formatted as a comma separated list of options. 104It contains at least the type of mount (see 105.Fa fs_type 106below) plus any additional options 107appropriate to the filesystem type. 108.Pp 109If the options ``userquota'' and/or ``groupquota'' are specified, 110the filesystem is automatically processed by the 111.Xr quotacheck 8 112command, and user and/or group disk quotas are enabled with 113.Xr quotaon 8 . 114By default, 115filesystem quotas are maintained in files named 116.Pa quota.user 117and 118.Pa quota.group 119which are located at the root of the associated filesystem. 120These defaults may be overridden by putting an equal sign 121and an alternative absolute pathname following the quota option. 122Thus, if the user quota file for 123.Pa /tmp 124is stored in 125.Pa /var/quotas/tmp.user , 126this location can be specified as: 127.Bd -literal -offset indent 128userquota=/var/quotas/tmp.user 129.Ed 130.Pp 131The type of the mount is extracted from the 132.Fa fs_mntops 133field and stored separately in the 134.Fa fs_type 135field (it is not deleted from the 136.Fa fs_mntops 137field). 138If 139.Fa fs_type 140is ``rw'' or ``ro'' then the filesystem whose name is given in the 141.Fa fs_file 142field is normally mounted read-write or read-only on the 143specified special file. 144If 145.Fa fs_type 146is ``sw'' then the special file is made available as a piece of swap 147space by the 148.Xr swapon 8 149command at the end of the system reboot procedure. 150The fields other than 151.Fa fs_spec 152and 153.Fa fs_type 154are unused. 155If 156.Fa fs_type 157is specified as ``xx'' the entry is ignored. 158This is useful to show disk partitions which are currently unused. 159.Pp 160The fifth field, 161.Pq Fa fs_freq , 162is used for these filesystems by the 163.Xr dump 8 164command to determine which filesystems need to be dumped. 165If the fifth field is not present, a value of zero is returned and 166.Xr dump 167will assume that the filesystem does not need to be dumped. 168.Pp 169The sixth field, 170.Pq Fa fs_passno , 171is used by the 172.Xr fsck 8 173program to determine the order in which filesystem checks are done 174at reboot time. 175The root filesystem should be specified with a 176.Fa fs_passno 177of 1, and other filesystems should have a 178.Fa fs_passno 179of 2. 180Filesystems within a drive will be checked sequentially, 181but filesystems on different drives will be checked at the 182same time to utilize parallelism available in the hardware. 183If the sixth field is not present or zero, 184a value of zero is returned and 185.Xr fsck 186will assume that the filesystem does not need to be checked. 187.Bd -literal 188#define FSTAB_RW "rw" /* read-write device */ 189#define FSTAB_RO "ro" /* read-only device */ 190#define FSTAB_SW "sw" /* swap device */ 191#define FSTAB_XX "xx" /* ignore totally */ 192 193struct fstab { 194 char *fs_spec; /* block special device name */ 195 char *fs_file; /* filesystem path prefix */ 196 char *fs_vfstype; /* type of filesystem */ 197 char *fs_mntops; /* comma separated mount options */ 198 char *fs_type; /* rw, ro, sw, or xx */ 199 int fs_freq; /* dump frequency, in days */ 200 int fs_passno; /* pass number on parallel dump */ 201}; 202.Ed 203.Pp 204The proper way to read records from 205.Pa fstab 206is to use the routines 207.Xr getfsent 3 , 208.Xr getfsspec 3 , 209.Xr getfstype 3 , 210and 211.Xr getfsfile 3 . 212.Sh FILES 213.Bl -tag -width /etc/fstab -compact 214.It Pa /etc/fstab 215The file 216.Nm fstab 217resides in 218.Pa /etc . 219.El 220.Sh SEE ALSO 221.Xr getfsent 3 222.Sh HISTORY 223The 224.Nm 225file format appeared in 226.Bx 4.0 . 227