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