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