1.\" $NetBSD: fstab.5,v 1.5 1995/02/03 18:17:32 jtc 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 ufs , 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 nine types of filesystems: 87.Bl -tag -width indent -offset indent 88.It Em fdesc 89an implementation of /dev/fd 90.It Em cd9660 91an ISO 9660 CD-ROM filesystem 92.It Em kernfs 93various and sundry kernel statistics 94.It Em mfs 95a local memory-based 96.Tn UNIX 97filesystem 98.It Em msdos 99a MSDOS ``FAT'' filesystem 100.It Em nfs 101a Sun Microsystems compatible ``Network File System'' 102.It Em procfs 103a local filesystem of process information 104.It Em swap 105a disk partition to be used for swapping 106.It Em ufs 107a local 108.Tn UNIX 109filesystem 110.El 111.Pp 112The fourth field, 113.Pq Fa fs_mntops , 114describes the mount options associated with the filesystem. 115It is formatted as a comma separated list of options. 116It contains at least the type of mount (see 117.Fa fs_type 118below) plus any additional options 119appropriate to the filesystem type. 120.Pp 121If the options ``userquota'' and/or ``groupquota'' are specified, 122the filesystem is automatically processed by the 123.Xr quotacheck 8 124command, and user and/or group disk quotas are enabled with 125.Xr quotaon 8 . 126By default, 127filesystem quotas are maintained in files named 128.Pa quota.user 129and 130.Pa quota.group 131which are located at the root of the associated filesystem. 132These defaults may be overridden by putting an equal sign 133and an alternative absolute pathname following the quota option. 134Thus, if the user quota file for 135.Pa /tmp 136is stored in 137.Pa /var/quotas/tmp.user , 138this location can be specified as: 139.Bd -literal -offset indent 140userquota=/var/quotas/tmp.user 141.Ed 142.Pp 143The type of the mount is extracted from the 144.Fa fs_mntops 145field and stored separately in the 146.Fa fs_type 147field (it is not deleted from the 148.Fa fs_mntops 149field). 150If 151.Fa fs_type 152is ``rw'' or ``ro'' then the filesystem whose name is given in the 153.Fa fs_file 154field is normally mounted read-write or read-only on the 155specified special file. 156If 157.Fa fs_type 158is ``sw'' then the special file is made available as a piece of swap 159space by the 160.Xr swapon 8 161command at the end of the system reboot procedure. 162The fields other than 163.Fa fs_spec 164and 165.Fa fs_type 166are unused. 167If 168.Fa fs_type 169is specified as ``xx'' the entry is ignored. 170This is useful to show disk partitions which are currently unused. 171.Pp 172The fifth field, 173.Pq Fa fs_freq , 174is used for these filesystems by the 175.Xr dump 8 176command to determine which filesystems need to be dumped. 177If the fifth field is not present, a value of zero is returned and 178.Xr dump 179will assume that the filesystem does not need to be dumped. 180.Pp 181The sixth field, 182.Pq Fa fs_passno , 183is used by the 184.Xr fsck 8 185program to determine the order in which filesystem checks are done 186at reboot time. 187The root filesystem should be specified with a 188.Fa fs_passno 189of 1, and other filesystems should have a 190.Fa fs_passno 191of 2. 192Filesystems within a drive will be checked sequentially, 193but filesystems on different drives will be checked at the 194same time to utilize parallelism available in the hardware. 195If the sixth field is not present or zero, 196a value of zero is returned and 197.Xr fsck 198will assume that the filesystem does not need to be checked. 199.Bd -literal 200#define FSTAB_RW "rw" /* read-write device */ 201#define FSTAB_RO "ro" /* read-only device */ 202#define FSTAB_SW "sw" /* swap device */ 203#define FSTAB_XX "xx" /* ignore totally */ 204 205struct fstab { 206 char *fs_spec; /* block special device name */ 207 char *fs_file; /* filesystem path prefix */ 208 char *fs_vfstype; /* type of filesystem */ 209 char *fs_mntops; /* comma separated mount options */ 210 char *fs_type; /* rw, ro, sw, or xx */ 211 int fs_freq; /* dump frequency, in days */ 212 int fs_passno; /* pass number on parallel dump */ 213}; 214.Ed 215.Pp 216The proper way to read records from 217.Pa fstab 218is to use the routines 219.Xr getfsent 3 , 220.Xr getfsspec 3 , 221.Xr getfstype 3 , 222and 223.Xr getfsfile 3 . 224.Sh FILES 225.Bl -tag -width /etc/fstab -compact 226.It Pa /etc/fstab 227The file 228.Nm fstab 229resides in 230.Pa /etc . 231.El 232.Sh SEE ALSO 233.Xr getfsent 3 234.Sh HISTORY 235The 236.Nm 237file format appeared in 238.Bx 4.0 . 239