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