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