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 21, 2013 36.Dt FSTAB 5 37.Os 38.Sh NAME 39.Nm fstab 40.Nd static information about the file systems 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 file system 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 special device or 68remote file system to be mounted. 69The contents are decoded by the 70.Xr strunvis 3 71function. 72This allows using spaces or tabs in the device name which would be 73interpreted as field separators otherwise. 74.Pp 75The second field, 76.Pq Fa fs_file , 77describes the mount point for the file system. 78For swap partitions, this field should be specified as 79.Dq none . 80The contents are decoded by the 81.Xr strunvis 3 82function, as above. 83.Pp 84The third field, 85.Pq Fa fs_vfstype , 86describes the type of the file system. 87The system can support various file system types. 88Only the root, /usr, and /tmp file systems need be statically 89compiled into the kernel; 90everything else will be automatically loaded at mount 91time. 92(Exception: the FFS cannot currently be demand-loaded.) 93Some people still prefer to statically 94compile other file systems as well. 95.Pp 96The fourth field, 97.Pq Fa fs_mntops , 98describes the mount options associated with the file system. 99It is formatted as a comma separated list of options. 100It contains at least the type of mount (see 101.Fa fs_type 102below) plus any additional options appropriate to the file system type. 103See the options flag 104.Pq Fl o 105in the 106.Xr mount 8 107page and the file system specific page, such as 108.Xr mount_nfs 8 , 109for additional options that may be specified. 110All options that can be given to the file system specific mount commands 111can be used in 112.Nm 113as well. 114They just need to be formatted a bit differently. 115The arguments of the 116.Fl o 117option can be used without the preceding 118.Fl o 119flag. 120Other options need both the file system specific flag and its argument, 121separated by an equal sign. 122For example, mounting an 123.Xr msdosfs 5 124filesystem, the options 125.Bd -literal -offset indent 126-o sync -o noatime -m 644 -M 755 -u foo -g bar 127.Ed 128.Pp 129should be written as 130.Bd -literal -offset indent 131sync,noatime,-m=644,-M=755,-u=foo,-g=bar 132.Ed 133.Pp 134in the option field of 135.Nm . 136.Pp 137If the options 138.Dq userquota 139and/or 140.Dq groupquota 141are specified, 142the file system is automatically processed by the 143.Xr quotacheck 8 144command, and user and/or group disk quotas are enabled with 145.Xr quotaon 8 . 146By default, 147file system quotas are maintained in files named 148.Pa quota.user 149and 150.Pa quota.group 151which are located at the root of the associated file system. 152These defaults may be overridden by putting an equal sign 153and an alternative absolute pathname following the quota option. 154Thus, if the user quota file for 155.Pa /tmp 156is stored in 157.Pa /var/quotas/tmp.user , 158this location can be specified as: 159.Bd -literal -offset indent 160userquota=/var/quotas/tmp.user 161.Ed 162.Pp 163If the option 164.Dq failok 165is specified, 166the system will ignore any error which happens during the mount of that filesystem, 167which would otherwise cause the system to drop into single user mode. 168This option is implemented by the 169.Xr mount 8 170command and will not be passed to the kernel. 171.Pp 172If the option 173.Dq noauto 174is specified, the file system will not be automatically 175mounted at system startup. 176Note that, for network file systems 177of third party types 178(i.e., types supported by additional software 179not included in the base system) 180to be automatically mounted at system startup, 181the 182.Va extra_netfs_types 183.Xr rc.conf 5 184variable must be used to extend the 185.Xr rc 8 186startup script's list of network file system types. 187.Pp 188If the option 189.Dq late 190is specified, the file system will be automatically mounted 191at a stage of system startup after remote mount points are mounted. 192For more detail about this option, 193see the 194.Xr mount 8 195manual page. 196.Pp 197The type of the mount is extracted from the 198.Fa fs_mntops 199field and stored separately in the 200.Fa fs_type 201field (it is not deleted from the 202.Fa fs_mntops 203field). 204If 205.Fa fs_type 206is 207.Dq rw 208or 209.Dq ro 210then the file system whose name is given in the 211.Fa fs_file 212field is normally mounted read-write or read-only on the 213specified special file. 214.Pp 215If 216.Fa fs_type 217is 218.Dq sw 219then the special file is made available as a piece of swap 220space by the 221.Xr swapon 8 222command at the end of the system reboot procedure. 223For vnode-backed swap spaces, 224.Dq file 225is supported in the 226.Fa fs_mntops 227field. 228When 229.Fa fs_spec 230is an 231.Xr md 4 232device file 233.Pq Do md Dc or Do md[0-9]* Dc 234and 235.Dq file 236is specified in 237.Fa fs_mntopts , 238an 239.Xr md 4 240device is created with the specified file used as backing store, 241and then the new device is used as swap space. 242The fields other than 243.Fa fs_spec 244and 245.Fa fs_type 246are unused. 247If 248.Fa fs_type 249is specified as 250.Dq xx 251the entry is ignored. 252This is useful to show disk partitions which are currently unused. 253.Pp 254The fifth field, 255.Pq Fa fs_freq , 256is used for these file systems by the 257.Xr dump 8 258command to determine which file systems need to be dumped. 259If the fifth field is not present, a value of zero is returned and 260.Nm dump 261will assume that the file system does not need to be dumped. 262If the fifth field is greater than 0, then it specifies the number of days 263between dumps for this file system. 264.Pp 265The sixth field, 266.Pq Fa fs_passno , 267is used by the 268.Xr fsck 8 269and 270.Xr quotacheck 8 271programs to determine the order in which file system and quota 272checks are done at reboot time. 273The 274.Fa fs_passno 275field can be any value between 0 and 276.Ql INT_MAX Ns -1 . 277.Pp 278The root file system should be specified with a 279.Fa fs_passno 280of 1, and other file systems should have a 281.Fa fs_passno 282of 2 or greater. 283A file system with a 284.Fa fs_passno 285value of 1 is always checked sequentially and be completed before 286another file system is processed, and it will be processed before 287all file systems with a larger 288.Fa fs_passno . 289.Pp 290For any given value of 291.Fa fs_passno , 292file systems within a drive will be checked sequentially, 293but file systems on different drives will be checked at the 294same time to utilize parallelism available in the hardware. 295Once all file system checks are complete for the current 296.Fa fs_passno , 297the same process will start over for the next 298.Fa fs_passno . 299.Pp 300If the sixth field is not present or is zero, 301a value of zero is returned and 302.Xr fsck 8 303and 304.Xr quotacheck 8 305will assume that the file system does not need to be checked. 306.Pp 307The 308.Fa fs_passno 309field can be used to implement finer control when 310the system utilities may determine that the file system resides 311on a different physical device, when it actually does not, as with a 312.Xr ccd 4 313device. 314All file systems with a lower 315.Fa fs_passno 316value will be completed before starting on file systems with a 317higher 318.Fa fs_passno 319value. 320E.g. all file systems with a 321.Fa fs_passno 322of 2 will be completed before any file systems with a 323.Fa fs_passno 324of 3 or greater are started. 325Gaps are allowed between the different 326.Fa fs_passno 327values. 328E.g. file systems listed in 329.Pa /etc/fstab 330may have 331.Fa fs_passno 332values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order 333within 334.Pa /etc/fstab . 335.Bd -literal 336#define FSTAB_RW "rw" /* read/write device */ 337#define FSTAB_RQ "rq" /* read/write with quotas */ 338#define FSTAB_RO "ro" /* read-only device */ 339#define FSTAB_SW "sw" /* swap device */ 340#define FSTAB_XX "xx" /* ignore totally */ 341 342struct fstab { 343 char *fs_spec; /* block special device name */ 344 char *fs_file; /* file system path prefix */ 345 char *fs_vfstype; /* File system type, ufs, nfs */ 346 char *fs_mntops; /* Mount options ala -o */ 347 char *fs_type; /* FSTAB_* from fs_mntops */ 348 int fs_freq; /* dump frequency, in days */ 349 int fs_passno; /* pass number on parallel fsck */ 350}; 351.Ed 352.Pp 353The proper way to read records from 354.Pa fstab 355is to use the routines 356.Xr getfsent 3 , 357.Xr getfsspec 3 , 358.Xr getfstype 3 , 359and 360.Xr getfsfile 3 . 361.Sh FILES 362.Bl -tag -width /etc/fstab -compact 363.It Pa /etc/fstab 364The file 365.Nm 366resides in 367.Pa /etc . 368.El 369.Sh SEE ALSO 370.Xr getfsent 3 , 371.Xr getvfsbyname 3 , 372.Xr ccd 4 , 373.Xr dump 8 , 374.Xr fsck 8 , 375.Xr mount 8 , 376.Xr quotacheck 8 , 377.Xr quotaon 8 , 378.Xr strunvis 3 , 379.Xr swapon 8 , 380.Xr umount 8 381.Sh HISTORY 382The 383.Nm 384file format appeared in 385.Bx 4.0 . 386