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