1.\" Copyright (c) 1980, 1989, 1991 The Regents of the University of California. 2.\" 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.\" from: @(#)fstab.5 6.5 (Berkeley) 5/10/91 33.\" $Id: fstab.5,v 1.2 1993/08/01 07:35:30 mycroft Exp $ 34.\" 35.Dd May 10, 1991 36.Dt FSTAB 5 37.Os BSD 4 38.Sh NAME 39.Nm fstab 40.Nd static information about the filesystems 41.Sh SYNOPSIS 42.Fd #include <fstab.h> 43.Sh DESCRIPTION 44The file 45.Nm fstab 46contains descriptive information about the various file 47systems. 48.Nm fstab 49is only read by programs, and not written; 50it is the duty of the system administrator to properly create 51and maintain this file. 52Each filesystem is described on a separate line; 53fields on each line are separated by tabs or spaces. 54The order of records in 55.Nm fstab 56is important because 57.Xr fsck 8 , 58.Xr mount 8 , 59and 60.Xr umount 8 61sequentially iterate through 62.Nm fstab 63doing their thing. 64.Pp 65The first field, 66.Pq Fa fs_spec , 67describes the block special device or 68remote filesystem to be mounted. 69For filesystems of type 70.Em ufs , 71the special file name is the block special file name, 72and not the character special file name. 73If a program needs the character special file name, 74the program must create it by appending a ``r'' after the 75last ``/'' in the special file name. 76.Pp 77The second field, 78.Pq Fa fs_file , 79describes the mount point for the filesystem. 80For swap partitions, this field should be specified as ``none''. 81.Pp 82The third field, 83.Pq Fa fs_vfstype , 84describes the type of the filesystem. 85The system currently supports four types of filesystems: 86.Bl -tag -width indent -offset indent 87.It Em ufs 88a local 89.Tn UNIX 90filesystem 91.It Em mfs 92a local memory-based 93.Tn UNIX 94filesystem 95.It Em nfs 96a Sun Microsystems compatible ``Network File System'' 97.It Em swap 98a disk partition to be used for swapping 99.El 100.Pp 101The fourth field, 102.Pq Fa fs_mntops , 103describes the mount options associated with the filesystem. 104It is formatted as a comma separated list of options. 105It contains at least the type of mount (see 106.Fa fs_type 107below) plus any additional options 108appropriate to the filesystem type. 109.Pp 110If the options ``userquota'' and/or ``groupquota'' are specified, 111the filesystem is automatically processed by the 112.Xr quotacheck 8 113command, and user and/or group disk quotas are enabled with 114.Xr quotaon 8 . 115By default, 116filesystem quotas are maintained in files named 117.Pa quota.user 118and 119.Pa quota.group 120which are located at the root of the associated filesystem. 121These defaults may be overridden by putting an equal sign 122and an alternative absolute pathname following the quota option. 123Thus, if the user quota file for 124.Pa /tmp 125is stored in 126.Pa /var/quotas/tmp.user , 127this location can be specified as: 128.Bd -literal -offset indent 129userquota=/var/quotas/tmp.user 130.Ed 131.Pp 132The type of the mount is extracted from the 133.Fa fs_mntops 134field and stored separately in the 135.Fa fs_type 136field (it is not deleted from the 137.Fa fs_mntops 138field). 139If 140.Fa fs_type 141is ``rw'' or ``ro'' then the filesystem whose name is given in the 142.Fa fs_file 143field is normally mounted read-write or read-only on the 144specified special file. 145If 146.Fa fs_type 147is ``sw'' then the special file is made available as a piece of swap 148space by the 149.Xr swapon 8 150command at the end of the system reboot procedure. 151The fields other than 152.Fa fs_spec 153and 154.Fa fs_type 155are unused. 156If 157.Fa fs_type 158is specified as ``xx'' the entry is ignored. 159This is useful to show disk partitions which are currently unused. 160.Pp 161The fifth field, 162.Pq Fa fs_freq , 163is used for these filesystems by the 164.Xr dump 8 165command to determine which filesystems need to be dumped. 166If the fifth field is not present, a value of zero is returned and 167.Xr dump 168will assume that the filesystem does not need to be dumped. 169.Pp 170The sixth field, 171.Pq Fa fs_passno , 172is used by the 173.Xr fsck 8 174program to determine the order in which filesystem checks are done 175at reboot time. 176The root filesystem should be specified with a 177.Fa fs_passno 178of 1, and other filesystems should have a 179.Fa fs_passno 180of 2. 181Filesystems within a drive will be checked sequentially, 182but filesystems on different drives will be checked at the 183same time to utilize parallelism available in the hardware. 184If the sixth field is not present or zero, 185a value of zero is returned and 186.Xr fsck 187will assume that the filesystem does not need to be checked. 188.Bd -literal 189#define FSTAB_RW "rw" /* read-write device */ 190#define FSTAB_RO "ro" /* read-only device */ 191#define FSTAB_SW "sw" /* swap device */ 192#define FSTAB_XX "xx" /* ignore totally */ 193 194struct fstab { 195 char *fs_spec; /* block special device name */ 196 char *fs_file; /* filesystem path prefix */ 197 char *fs_vfstype; /* type of filesystem */ 198 char *fs_mntops; /* comma separated mount options */ 199 char *fs_type; /* rw, ro, sw, or xx */ 200 int fs_freq; /* dump frequency, in days */ 201 int fs_passno; /* pass number on parallel dump */ 202}; 203.Ed 204.Pp 205The proper way to read records from 206.Pa fstab 207is to use the routines 208.Xr getfsent 3 , 209.Xr getfsspec 3 , 210.Xr getfstype 3 , 211and 212.Xr getfsfile 3 . 213.Sh FILES 214.Bl -tag -width /etc/fstab -compact 215.It Pa /etc/fstab 216The file 217.Nm fstab 218resides in 219.Pa /etc . 220.El 221.Sh SEE ALSO 222.Xr getfsent 3 223.Sh HISTORY 224The 225.Nm 226file format appeared in 227.Bx 4.0 . 228