1.\" $OpenBSD: fstab.5,v 1.16 2001/08/03 15:21:16 mpech Exp $ 2.\" $NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $ 3.\" 4.\" Copyright (c) 1980, 1989, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. All advertising materials mentioning features or use of this software 16.\" must display the following acknowledgement: 17.\" This product includes software developed by the University of 18.\" California, Berkeley and its contributors. 19.\" 4. Neither the name of the University nor the names of its contributors 20.\" may be used to endorse or promote products derived from this software 21.\" without specific prior written permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 36.\" 37.Dd June 5, 1993 38.Dt FSTAB 5 39.Os 40.Sh NAME 41.Nm fstab 42.Nd static information about the filesystems 43.Sh SYNOPSIS 44.Fd #include <fstab.h> 45.Sh DESCRIPTION 46The 47.Nm 48file contains descriptive information about the various file systems. 49.Nm 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 57is important because 58.Xr fsck 8 , 59.Xr mount 8 , 60and 61.Xr umount 8 62sequentially iterate through 63.Nm 64doing their thing. 65.Pp 66The first field, 67.Fa fs_spec , 68describes the block special device or remote filesystem to be mounted. 69For filesystems of type 70.Tn ffs , 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 an 75.Dq r 76after the last 77.Dq / 78in the special file name. 79.Pp 80The second field, 81.Fa fs_file , 82describes the mount point for the filesystem. 83For swap partitions, this field should be specified as 84.Dq none . 85.Pp 86The third field, 87.Fa fs_vfstype , 88describes the type of the filesystem. 89The system currently supports eleven types of filesystems: 90.Pp 91.Bl -tag -width indent -offset indent -compact 92.It adosfs 93An 94.Tn AmigaDOS 95filesystem. 96.It cd9660 97An ISO9660 CD-ROM filesystem. 98.It fdesc 99An implementation of 100.Pa /dev/fd . 101.It ffs 102A local 103.Ux 104filesystem. 105.It ext2fs 106A local Linux compatible ext2fs 107filesystem. 108.It kernfs 109Various and sundry kernel statistics. 110.It mfs 111A local memory-based 112.Ux 113filesystem. 114.It msdos 115An 116.Tn MS-DOS 117FAT filesystem. 118.It nfs 119A Sun Microsystems compatible Network File System. 120.It procfs 121A local filesystem containing process information. 122.It swap 123A disk partition to be used for swapping. 124.It union 125A translucent filesystem. 126.El 127.Pp 128The fourth field, 129.Fa fs_mntops , 130describes the mount options associated with the filesystem. 131It is formatted as a comma separated list of options. 132It contains at least the type of mount (see 133.Fa fs_type 134below) plus any additional options appropriate to the filesystem type. 135.Pp 136The option 137.Dq auto 138can be used in the 139.Dq noauto 140form to cause 141a file system not to be mounted automatically (with 142.Ic mount -a , 143or at system boot time). 144.Pp 145If the options 146.Dq userquota 147and/or 148.Dq groupquota 149are specified, the filesystem is automatically processed by the 150.Xr quotacheck 8 151command, and user and/or group disk quotas are enabled with 152.Xr quotaon 8 . 153By default, filesystem quotas are maintained in files named 154.Pa quota.user 155and 156.Pa quota.group 157which are located at the root of the associated filesystem. 158These defaults may be overridden by putting an equal sign 159and an alternative absolute pathname following the quota option. 160Thus, if the user quota file for 161.Pa /tmp 162is stored in 163.Pa /var/quotas/tmp.user , 164this location can be specified as: 165.Bd -literal -offset indent 166userquota=/var/quotas/tmp.user 167.Ed 168.Pp 169The type of the mount is extracted from the first parameter of the 170.Fa fs_mntops 171field and stored separately in the 172.Fa fs_type 173field (it is not deleted from the 174.Fa fs_mntops 175field). 176If 177.Fa fs_type 178is 179.Dq rw 180or 181.Dq ro 182then the filesystem whose name is given in the 183.Fa fs_file 184field is normally mounted read-write or read-only on the 185specified special file. 186If 187.Fa fs_type 188is 189.Dq sw 190then the special file is made available as a piece of swap space by the 191.Xr swapon 8 192command at the end of the system reboot procedure. 193The fields other than 194.Fa fs_spec 195and 196.Fa fs_type 197are unused. 198If 199.Fa fs_type 200is specified as 201.Dq xx 202the entry is ignored. 203This is useful to show disk partitions which are currently unused. 204.Pp 205The fifth field, 206.Fa fs_freq , 207is used for these filesystems by the 208.Xr dump 8 209command to determine which filesystems need to be dumped. 210If the fifth field is not present, a value of zero is returned and 211.Xr dump 212will assume that the filesystem does not need to be dumped. 213.Pp 214The sixth field, 215.Fa fs_passno , 216is used by the 217.Xr fsck 8 218program to determine the order in which filesystem checks are done 219at reboot time. 220The root filesystem should be specified with a 221.Fa fs_passno 222of 1, and other filesystems should have a 223.Fa fs_passno 224of 2. 225Filesystems within a drive will be checked sequentially, 226but filesystems on different drives will be checked at the 227same time to utilize parallelism available in the hardware. 228If the sixth field is not present or is zero, 229a value of zero is returned and 230.Xr fsck 8 231will assume that the filesystem does not need to be checked. 232.Bd -literal 233#define FSTAB_RW "rw" /* read-write device */ 234#define FSTAB_RO "ro" /* read-only device */ 235#define FSTAB_SW "sw" /* swap device */ 236#define FSTAB_XX "xx" /* ignore totally */ 237 238struct fstab { 239 char *fs_spec; /* block special device name */ 240 char *fs_file; /* filesystem path prefix */ 241 char *fs_vfstype; /* type of filesystem */ 242 char *fs_mntops; /* comma separated mount options */ 243 char *fs_type; /* rw, ro, sw, or xx */ 244 int fs_freq; /* dump frequency, in days */ 245 int fs_passno; /* pass number on parallel fsck */ 246}; 247.Ed 248.Pp 249The proper way to read records from 250.Pa fstab 251is to use the routines 252.Xr getfsent 3 , 253.Xr getfsspec 3 , 254.Xr getfstype 3 , 255and 256.Xr getfsfile 3 . 257.Sh EXAMPLES 258Here is a sample 259.Pa /etc/fstab 260file: 261.Bd -literal -offset indent 262/dev/sd0a / ffs rw 1 1 263/dev/sd0b none swap sw 0 0 264/dev/sd0e /var ffs rw 1 2 265#/dev/sd0f /tmp ffs rw 1 3 266/dev/sd0g /usr ffs rw 1 4 267/dev/sd0h /usr/local ffs rw 1 5 268/dev/sd0i /home ffs rw 1 6 269 270/dev/sd1b none swap sw 0 0 271/dev/cd0a /cdrom cd9660 ro,noauto 0 0 272 273/kern /kern kernfs ro 0 0 274/proc /proc procfs rw 0 0 275.Ed 276.Sh FILES 277.Bl -tag -width /etc/fstab -compact 278.It Pa /etc/fstab 279.El 280.Sh SEE ALSO 281.Xr getfsent 3 282.Sh HISTORY 283The 284.Nm 285file format appeared in 286.Bx 4.0 . 287