1.\" $OpenBSD: fstab.5,v 1.45 2011/04/17 20:17:12 krw 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 $Mdocdate: April 17 2011 $ 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. 72A block special device may be specified by pathname 73or by 74.Xr disklabel 8 75UID (DUID). 76For filesystems of type MFS 77the special file name is typically that of the primary swap area; 78if the keyword 79.Dq swap 80is used instead of a special file name, 81default configuration parameters are used. 82If a program needs the character special file name, 83the program must create it by appending an 84.Sq r 85after the last 86.Sq / 87in the special file name. 88.Pp 89The second field, 90.Fa fs_file , 91describes the mount point for the filesystem. 92For swap partitions, this field should be specified as 93.Dq none . 94.Pp 95The third field, 96.Fa fs_vfstype , 97describes the type of the filesystem. 98The system currently supports the following types of filesystems: 99.Pp 100.Bl -tag -width indent -offset indent -compact 101.It cd9660 102An ISO 9660 CD-ROM filesystem. 103.It ext2fs 104A local Linux compatible ext2fs 105filesystem. 106.It ffs 107A local 108.Ux 109filesystem. 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 ntfs 121An NTFS filesystem. 122.It procfs 123A local filesystem containing process information. 124.It swap 125A disk partition to be used for swapping. 126.It udf 127A UDF filesystem. 128.It vnd 129A VND image file. 130.El 131.Pp 132The fourth field, 133.Fa fs_mntops , 134describes the mount options associated with the filesystem. 135It is formatted as a comma separated list of options. 136It contains at least the type of mount (see 137.Fa fs_type 138below) plus any additional options appropriate to the filesystem type. 139.Pp 140The option 141.Dq auto 142can be used in the 143.Dq noauto 144form to cause 145a file system not to be mounted automatically (with 146.Ic mount -A 147or 148.Ic mount -a , 149or at system boot time). 150.Pp 151If the options 152.Dq userquota 153and/or 154.Dq groupquota 155are specified, the filesystem is automatically processed by the 156.Xr quotacheck 8 157command, and user and/or group disk quotas are enabled with 158.Xr quotaon 8 . 159By default, filesystem quotas are maintained in files named 160.Pa quota.user 161and 162.Pa quota.group 163which are located at the root of the associated filesystem. 164These defaults may be overridden by putting an equal sign 165and an alternative absolute pathname following the quota option. 166Thus, if the user quota file for 167.Pa /tmp 168is stored in 169.Pa /var/quotas/tmp.user , 170this location can be specified as: 171.Bd -literal -offset indent 172userquota=/var/quotas/tmp.user 173.Ed 174.Pp 175The type of the mount is extracted from the first parameter of the 176.Fa fs_mntops 177field and stored separately in the 178.Fa fs_type 179field (it is not deleted from the 180.Fa fs_mntops 181field). 182If 183.Fa fs_type 184is 185.Dq rw , 186.Dq rq , 187or 188.Dq ro 189then the filesystem whose name is given in the 190.Fa fs_file 191field is normally mounted read-write or read-only on the 192specified special file. 193If 194.Fa fs_type 195is 196.Dq sw 197then the special file is made available as a piece of swap space by the 198.Xr swapon 8 199command at the end of the system reboot procedure. 200The fields other than 201.Fa fs_spec 202and 203.Fa fs_type 204are unused. 205If 206.Fa fs_type 207is specified as 208.Dq xx 209the entry is ignored. 210This is useful to show disk partitions which are currently unused. 211.Pp 212The fifth field, 213.Fa fs_freq , 214is used by the 215.Fl W 216and 217.Fl w 218options of 219.Xr dump 8 220to recommend which filesystems should be backed up. 221The value specifies the number of days 222after which a dump is regarded as being old; 223if it is not present, a value of zero is returned and 224.Xr dump 8 225will assume that the filesystem does not need to be dumped. 226.Pp 227The sixth field, 228.Fa fs_passno , 229is used by the 230.Xr fsck 8 231program to determine the order in which filesystem checks are done 232at reboot time. 233The root filesystem should be specified with a 234.Fa fs_passno 235of 1, and other filesystems should have a 236.Fa fs_passno 237of 2. 238Filesystems within a drive will be checked sequentially, 239but filesystems on different drives will be checked at the 240same time to utilize parallelism available in the hardware. 241If the sixth field is not present or is zero, 242a value of zero is returned and 243.Xr fsck 8 244will assume that the filesystem does not need to be checked. 245.Bd -literal 246#define FSTAB_RW "rw" /* read/write device */ 247#define FSTAB_RQ "rq" /* read/write with quotas * 248#define FSTAB_RO "ro" /* read-only device */ 249#define FSTAB_SW "sw" /* swap device */ 250#define FSTAB_XX "xx" /* ignore totally */ 251 252struct fstab { 253 char *fs_spec; /* block special device name */ 254 char *fs_file; /* filesystem path prefix */ 255 char *fs_vfstype; /* type of filesystem */ 256 char *fs_mntops; /* comma separated mount options */ 257 char *fs_type; /* rw, rq, ro, sw, or xx */ 258 int fs_freq; /* dump frequency, in days */ 259 int fs_passno; /* pass number on parallel fsck */ 260}; 261.Ed 262.Pp 263The proper way to read records from 264.Pa fstab 265is to use the routines 266.Xr getfsent 3 , 267.Xr getfsspec 3 , 268and 269.Xr getfsfile 3 . 270.Sh FILES 271.Bl -tag -width /etc/fstab -compact 272.It Pa /etc/fstab 273.El 274.Sh EXAMPLES 275Here is a sample 276.Pa /etc/fstab 277file: 278.Bd -literal -offset indent 279/dev/sd0b none swap sw 280/dev/sd1b none swap sw 281/dev/sd0a / ffs rw 1 1 282/dev/sd0e /var ffs rw,nodev,nosuid 1 2 283#/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2 284swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0 285/dev/sd0g /usr ffs rw,nodev 1 2 286/dev/sd0h /usr/local ffs rw,nodev 1 2 287/dev/sd0i /home ffs rw,nodev,nosuid 1 2 288/dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2 289/dev/cd0a /cdrom cd9660 ro,noauto 0 0 2905b27c2761a9b0b06.i /mnt/key msdos rw,noauto 0 0 291server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0 292.Ed 293.Sh SEE ALSO 294.Xr quota 1 , 295.Xr getfsent 3 , 296.Xr fsck 8 , 297.Xr mount 8 , 298.Xr quotacheck 8 , 299.Xr quotaon 8 300.Sh HISTORY 301The 302.Nm 303file format appeared in 304.Bx 4.0 . 305