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.\" $FreeBSD$ 34.\" 35.Dd June 5, 1993 36.Dt FSTAB 5 37.Os 38.Sh NAME 39.Nm fstab 40.Nd static information about the filesystems 41.Sh SYNOPSIS 42.In fstab.h 43.Sh DESCRIPTION 44The file 45.Nm 46contains descriptive information about the various file 47systems. 48.Nm 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 56is important because 57.Xr fsck 8 , 58.Xr mount 8 , 59and 60.Xr umount 8 61sequentially iterate through 62.Nm 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 can support various filesystem types. 86Only the root, /usr, and /tmp filesystems need be statically 87compiled into the kernel; 88everything else will be automatically loaded at mount 89time. (Exception: the UFS family - FFS and LFS cannot 90currently be demand-loaded.) Some people still prefer to statically 91compile other filesystems as well. 92.Pp 93The fourth field, 94.Pq Fa fs_mntops , 95describes the mount options associated with the filesystem. 96It is formatted as a comma separated list of options. 97It contains at least the type of mount (see 98.Fa fs_type 99below) plus any additional options 100appropriate to the filesystem type. See the options flag 101.Pq Fl o 102in the 103.Xr mount 8 104page and the filesystem specific page, such as 105.Xr mount_nfs 8 , 106for additional options that may be specified. 107.Pp 108If the options ``userquota'' and/or ``groupquota'' are specified, 109the filesystem is automatically processed by the 110.Xr quotacheck 8 111command, and user and/or group disk quotas are enabled with 112.Xr quotaon 8 . 113By default, 114filesystem quotas are maintained in files named 115.Pa quota.user 116and 117.Pa quota.group 118which are located at the root of the associated filesystem. 119These defaults may be overridden by putting an equal sign 120and an alternative absolute pathname following the quota option. 121Thus, if the user quota file for 122.Pa /tmp 123is stored in 124.Pa /var/quotas/tmp.user , 125this location can be specified as: 126.Bd -literal -offset indent 127userquota=/var/quotas/tmp.user 128.Ed 129.Pp 130If the option ``noauto'' is specified, the filesystem will not be automatically 131mounted at system startup. 132Note that, for network filesystems 133of third party types 134(i.e. types supported by additional software 135not included in the base system) 136to be automatically mounted at system startup, 137the 138.Va extra_netfs_types 139.Xr rc.conf 5 140variable must be used to extend the 141.Xr rc 8 142startup script's list of network filesystem types. 143.Pp 144The type of the mount is extracted from the 145.Fa fs_mntops 146field and stored separately in the 147.Fa fs_type 148field (it is not deleted from the 149.Fa fs_mntops 150field). 151If 152.Fa fs_type 153is ``rw'' or ``ro'' then the filesystem whose name is given in the 154.Fa fs_file 155field is normally mounted read-write or read-only on the 156specified special file. 157If 158.Fa fs_type 159is ``sw'' then the special file is made available as a piece of swap 160space by the 161.Xr swapon 8 162command at the end of the system reboot procedure. 163The fields other than 164.Fa fs_spec 165and 166.Fa fs_type 167are unused. 168If 169.Fa fs_type 170is specified as ``xx'' the entry is ignored. 171This is useful to show disk partitions which are currently unused. 172.Pp 173The fifth field, 174.Pq Fa fs_freq , 175is used for these filesystems by the 176.Xr dump 8 177command to determine which filesystems need to be dumped. 178If the fifth field is not present, a value of zero is returned and 179.Nm dump 180will assume that the filesystem does not need to be dumped. 181.Pp 182The sixth field, 183.Pq Fa fs_passno , 184is used by the 185.Xr fsck 8 186program to determine the order in which filesystem checks are done 187at reboot time. 188The root filesystem should be specified with a 189.Fa fs_passno 190of 1, and other filesystems should have a 191.Fa fs_passno 192of 2. 193Filesystems within a drive will be checked sequentially, 194but filesystems on different drives will be checked at the 195same time to utilize parallelism available in the hardware. 196If the sixth field is not present or is zero, 197a value of zero is returned and 198.Xr fsck 8 199will assume that the filesystem does not need to be checked. 200.Bd -literal 201#define FSTAB_RW "rw" /* read/write device */ 202#define FSTAB_RQ "rq" /* read/write with quotas */ 203#define FSTAB_RO "ro" /* read-only device */ 204#define FSTAB_SW "sw" /* swap device */ 205#define FSTAB_XX "xx" /* ignore totally */ 206 207struct fstab { 208 char *fs_spec; /* block special device name */ 209 char *fs_file; /* filesystem path prefix */ 210 char *fs_vfstype; /* File system type, ufs, nfs */ 211 char *fs_mntops; /* Mount options ala -o */ 212 char *fs_type; /* FSTAB_* from fs_mntops */ 213 int fs_freq; /* dump frequency, in days */ 214 int fs_passno; /* pass number on parallel fsck */ 215}; 216.Ed 217.Pp 218The proper way to read records from 219.Pa fstab 220is to use the routines 221.Xr getfsent 3 , 222.Xr getfsspec 3 , 223.Xr getfstype 3 , 224and 225.Xr getfsfile 3 . 226.Sh FILES 227.Bl -tag -width /etc/fstab -compact 228.It Pa /etc/fstab 229The file 230.Nm 231resides in 232.Pa /etc . 233.El 234.Sh SEE ALSO 235.Xr getfsent 3 , 236.Xr getvfsbyname 3 , 237.Xr dump 8 , 238.Xr fsck 8 , 239.Xr mount 8 , 240.Xr quotacheck 8 , 241.Xr quotaon 8 , 242.Xr swapon 8 , 243.Xr umount 8 244.Sh HISTORY 245The 246.Nm 247file format appeared in 248.Bx 4.0 . 249