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