1.\" $NetBSD: fstab.5,v 1.7 1996/05/21 10:55:52 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 swapon 8 171command at the end of the system reboot procedure. 172The fields other than 173.Fa fs_spec 174and 175.Fa fs_type 176are unused. 177If 178.Fa fs_type 179is specified as ``xx'' the entry is ignored. 180This is useful to show disk partitions which are currently unused. 181.Pp 182The fifth field, 183.Pq Fa fs_freq , 184is used for these filesystems by the 185.Xr dump 8 186command to determine which filesystems need to be dumped. 187If the fifth field is not present, a value of zero is returned and 188.Xr dump 189will assume that the filesystem does not need to be dumped. 190.Pp 191The sixth field, 192.Pq Fa fs_passno , 193is used by the 194.Xr fsck 8 195program to determine the order in which filesystem checks are done 196at reboot time. 197The root filesystem should be specified with a 198.Fa fs_passno 199of 1, and other filesystems should have a 200.Fa fs_passno 201of 2. 202Filesystems within a drive will be checked sequentially, 203but filesystems on different drives will be checked at the 204same time to utilize parallelism available in the hardware. 205If the sixth field is not present or zero, 206a value of zero is returned and 207.Xr fsck 208will assume that the filesystem does not need to be checked. 209.Bd -literal 210#define FSTAB_RW "rw" /* read-write device */ 211#define FSTAB_RO "ro" /* read-only device */ 212#define FSTAB_SW "sw" /* swap device */ 213#define FSTAB_XX "xx" /* ignore totally */ 214 215struct fstab { 216 char *fs_spec; /* block special device name */ 217 char *fs_file; /* filesystem path prefix */ 218 char *fs_vfstype; /* type of filesystem */ 219 char *fs_mntops; /* comma separated mount options */ 220 char *fs_type; /* rw, ro, sw, or xx */ 221 int fs_freq; /* dump frequency, in days */ 222 int fs_passno; /* pass number on parallel dump */ 223}; 224.Ed 225.Pp 226The proper way to read records from 227.Pa fstab 228is to use the routines 229.Xr getfsent 3 , 230.Xr getfsspec 3 , 231.Xr getfstype 3 , 232and 233.Xr getfsfile 3 . 234.Sh FILES 235.Bl -tag -width /etc/fstab -compact 236.It Pa /etc/fstab 237The file 238.Nm fstab 239resides in 240.Pa /etc . 241.El 242.Sh SEE ALSO 243.Xr getfsent 3 244.Sh HISTORY 245The 246.Nm 247file format appeared in 248.Bx 4.0 . 249