1.\" $NetBSD: fstab.5,v 1.32 2005/10/03 14:56:32 wiz 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 September 29, 2005 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 filecore -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 109.Pa /dev/fd . 110.It Em ffs 111a local 112.Ux 113filesystem. 114.It Em filecore 115a filesystem for 116.Tn RISC\ OS . 117.It Em kernfs 118various and sundry kernel statistics. 119.It Em lfs 120a log-structured file-system. 121Currently does not work. 122.It Em mfs 123a local memory-based 124.Ux 125filesystem. 126.It Em msdos 127an 128.Tn MS-DOS 129.Dq FAT filesystem . 130.It Em nfs 131a Sun Microsystems compatible 132.Dq Network File System . 133.It Em ntfs 134a filesystem used by 135.Tn Windows NT . 136Still experimental. 137.It Em null 138a loop-back filesystem, allowing parts of the system to be viewed 139elsewhere. 140.It Em overlay 141a demonstration of layered filesystems. 142.It Em portal 143a general filesystem interface, currently supports TCP and FS mounts. 144.It Em procfs 145a local filesystem of process information. 146.It Em ptyfs 147a pseudo-terminal device file system. 148.It Em smbfs 149a shared resource from an SMB/CIFS file server. 150.It Em swap 151a disk partition to be used for swapping and paging. 152.It Em tmpfs 153an efficient memory file system. 154.It Em umap 155a user and group re-mapping filesystem. 156.It Em union 157a translucent filesystem. 158.El 159.Pp 160The fourth field, 161.Pq Fa fs_mntops , 162describes the mount options associated with the filesystem. 163It is formatted as a comma separated list of options. 164It contains at least the type of mount (see 165.Fa fs_type 166below) plus any additional options 167appropriate to the filesystem type. 168.Pp 169The option 170.Dq auto 171can be used in the 172.Dq noauto 173form to cause 174a file system not to be mounted automatically (with 175.Dq mount -a 176, 177or system boot time). 178.Pp 179If the options 180.Dq userquota 181and/or 182.Dq groupquota 183are specified, 184the filesystem is automatically processed by the 185.Xr quotacheck 8 186command, and user and/or group disk quotas are enabled with 187.Xr quotaon 8 . 188By default, 189filesystem quotas are maintained in files named 190.Pa quota.user 191and 192.Pa quota.group 193which are located at the root of the associated filesystem. 194These defaults may be overridden by putting an equal sign 195and an alternative absolute pathname following the quota option. 196Thus, if the user quota file for 197.Pa /tmp 198is stored in 199.Pa /var/quotas/tmp.user , 200this location can be specified as: 201.Bd -literal -offset indent 202userquota=/var/quotas/tmp.user 203.Ed 204.Pp 205The type of the mount is extracted from the 206.Fa fs_mntops 207field and stored separately in the 208.Fa fs_type 209field (it is not deleted from the 210.Fa fs_mntops 211field). 212If 213.Fa fs_type 214is 215.Dq rw 216or 217.Dq ro 218then the filesystem whose name is given in the 219.Fa fs_file 220field is normally mounted read-write or read-only on the 221specified special file. 222If 223.Fa fs_type 224is 225.Dq sw 226or 227.Dq dp 228then the special file is made available as a piece of swap 229or dump 230space by the 231.Xr swapctl 8 232command towards the beginning of the system reboot procedure. 233See 234.Xr swapctl 8 235for more information on configuring swap and dump devices. 236The fields other than 237.Fa fs_spec 238and 239.Fa fs_type 240are unused. 241If 242.Fa fs_type 243is specified as 244.Dq xx 245the entry is ignored. 246This is useful to show disk partitions which are currently unused. 247.Pp 248The fifth field, 249.Pq Fa fs_freq , 250is used for these filesystems by the 251.Xr dump 8 252command to determine which filesystems need to be dumped. 253If the fifth field is not present, a value of zero is returned and 254.Xr dump 8 255will assume that the filesystem does not need to be dumped. 256.Pp 257The sixth field, 258.Pq Fa fs_passno , 259is used by the 260.Xr fsck 8 261program to determine the order in which filesystem checks are done 262at reboot time. 263The root filesystem should be specified with a 264.Fa fs_passno 265of 1, and other filesystems should have a 266.Fa fs_passno 267of 2. 268Filesystems within a drive will be checked sequentially, 269but filesystems on different drives will be checked at the 270same time to use parallelism available in the hardware. 271If the sixth field is not present or zero, 272a value of zero is returned and 273.Xr fsck 8 274will assume that the filesystem does not need to be checked. 275.Bd -literal 276#define FSTAB_RW "rw" /* read-write device */ 277#define FSTAB_RQ "rq" /* read/write with quotas */ 278#define FSTAB_RO "ro" /* read-only device */ 279#define FSTAB_SW "sw" /* swap device */ 280#define FSTAB_DP "dp" /* dump device */ 281#define FSTAB_XX "xx" /* ignore totally */ 282 283struct fstab { 284 char *fs_spec; /* block special device name */ 285 char *fs_file; /* filesystem path prefix */ 286 char *fs_vfstype; /* type of filesystem */ 287 char *fs_mntops; /* comma separated mount options */ 288 char *fs_type; /* rw, ro, sw, or xx */ 289 int fs_freq; /* dump frequency, in days */ 290 int fs_passno; /* pass number on parallel fsck */ 291}; 292.Ed 293.Pp 294The proper way to read records from 295.Pa fstab 296is to use the routines 297.Xr getfsent 3 , 298.Xr getfsspec 3 , 299and 300.Xr getfsfile 3 . 301.Sh FILES 302.Bl -tag -width /etc/fstab 303.It Pa /etc/fstab 304The location of 305.Nm 306configuration file. 307.It Pa /usr/share/examples/fstab/ 308Some useful configuration examples. 309.El 310.Sh SEE ALSO 311.Xr getfsent 3 , 312.Xr mount 8 , 313.Xr swapctl 8 314.Sh HISTORY 315The 316.Nm 317file format appeared in 318.Bx 4.0 . 319