1.\" $NetBSD: fstab.5,v 1.39 2012/02/13 19:53:25 dholland 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 March 6, 2011 33.Dt FSTAB 5 34.Os 35.Sh NAME 36.Nm fstab 37.Nd file system 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 file system is described on a separate line; 49fields on each line are separated by tabs or spaces. 50Lines beginning 51with 52.Dq # 53are comments. 54The order of records in 55.Nm 56is important because 57.Xr fsck 8 , 58.Xr mount 8 , 59and 60.Xr umount 8 61sequentially iterate through 62.Nm 63doing their respective tasks. 64.Pp 65Each configuration line/record in 66.Nm 67has the format: 68.Dl fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno 69.Pp 70The first field, 71.Pq Fa fs_spec , 72describes the block special device or 73remote file system to be mounted. 74For file systems of type 75.Em ffs , 76the special file name is the block special file name, 77and not the character special file name. 78If a program needs the character special file name, 79the program must create it by appending a 80.Dq r 81after the 82last 83.Dq / 84in the special file name. 85.Pp 86The second field, 87.Pq Fa fs_file , 88describes the mount point for the file system. 89For swap and dump partitions, this field should be specified as 90.Dq none . 91.Pp 92The third field, 93.Pq Fa fs_vfstype , 94describes the type of the file system. 95The system currently supports these file systems: 96.Bl -tag -width filecore -offset indent 97.It Em adosfs 98an 99.Tn AmigaDOS 100file system. 101.It Em cd9660 102an 103.Tn ISO 1049660 CD-ROM file system. 105.It Em ext2fs 106an implementation of the Linux 107.Dq Second Extended File-system . 108.It Em fdesc 109an implementation of 110.Pa /dev/fd . 111.It Em ffs 112a local 113.Ux 114file system. 115.It Em filecore 116a file system for 117.Tn RISC\ OS . 118.It Em kernfs 119various and sundry kernel statistics. 120.It Em lfs 121a log-structured file-system. 122.It Em mfs 123a local memory-based 124.Ux 125file system. 126.It Em msdos 127an 128.Tn MS-DOS 129.Dq FAT file system . 130.It Em nfs 131a Sun Microsystems compatible 132.Dq Network File System . 133.It Em ntfs 134a file system used by 135.Tn Windows NT . 136Still experimental. 137.It Em null 138a loop-back file system, allowing parts of the system to be viewed 139elsewhere. 140.It Em overlay 141a demonstration of layered file systems. 142.It Em portal 143a general file system interface, currently supports TCP and FS mounts. 144.It Em procfs 145a local file system 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 file system. 156.It Em union 157a translucent file system. 158.El 159.Pp 160The fourth field, 161.Pq Fa fs_mntops , 162describes the mount options associated with the file system. 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 file system 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 file system is automatically processed by the 185.Xr quotacheck 8 186command, and legacy user and/or group disk quotas are enabled with 187.Xr quotaon 8 . 188By default, 189file system quotas are maintained in files named 190.Pa quota.user 191and 192.Pa quota.group 193which are located at the root of the associated file system. 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 205It is recommended to turn on the new, in-file system quota with 206.Xr tunefs 8 207or at 208.Xr newfs 8 209time, and to not use the 210.Dq userquota 211or 212.Dq groupquota 213options. 214Migration of limits to the new in-file system quota can be handled 215via 216.Xr quotadump 8 217and 218.Xr quotarestore 8 . 219.Pp 220The option 221.Dq rump 222is used to mount the file system using a 223.Xr rump 3 224userspace server instead of the kernel server. 225.Pp 226The type of the mount is extracted from the 227.Fa fs_mntops 228field and stored separately in the 229.Fa fs_type 230field (it is not deleted from the 231.Fa fs_mntops 232field). 233If 234.Fa fs_type 235is 236.Dq rw 237or 238.Dq ro 239then the file system whose name is given in the 240.Fa fs_file 241field is normally mounted read-write or read-only on the 242specified special file. 243If 244.Fa fs_type 245is 246.Dq sw 247or 248.Dq dp 249then the special file is made available as a piece of swap 250or dump 251space by the 252.Xr swapctl 8 253command towards the beginning of the system reboot procedure. 254See 255.Xr swapctl 8 256for more information on configuring swap and dump devices. 257The fields other than 258.Fa fs_spec 259and 260.Fa fs_type 261are unused. 262If 263.Fa fs_type 264is specified as 265.Dq xx 266the entry is ignored. 267This is useful to show disk partitions which are currently unused. 268.Pp 269The fifth field, 270.Pq Fa fs_freq , 271is used for these file systems by the 272.Xr dump 8 273command to determine which file systems need to be dumped. 274If the fifth field is not present, a value of zero is returned and 275.Xr dump 8 276will assume that the file system does not need to be dumped. 277.Pp 278The sixth field, 279.Pq Fa fs_passno , 280is used by the 281.Xr fsck 8 282program to determine the order in which file system checks are done 283at reboot time. 284The root file system should be specified with a 285.Fa fs_passno 286of 1, and other file systems should have a 287.Fa fs_passno 288of 2. 289Filesystems within a drive will be checked sequentially, 290but file systems on different drives will be checked at the 291same time to use parallelism available in the hardware. 292If the sixth field is not present or zero, 293a value of zero is returned and 294.Xr fsck 8 295will assume that the file system does not need to be checked. 296.Bd -literal 297#define FSTAB_RW "rw" /* read-write device */ 298#define FSTAB_RQ "rq" /* read/write with quotas */ 299#define FSTAB_RO "ro" /* read-only device */ 300#define FSTAB_SW "sw" /* swap device */ 301#define FSTAB_DP "dp" /* dump device */ 302#define FSTAB_XX "xx" /* ignore totally */ 303 304struct fstab { 305 char *fs_spec; /* block special device name */ 306 char *fs_file; /* file system path prefix */ 307 char *fs_vfstype; /* type of file system */ 308 char *fs_mntops; /* comma separated mount options */ 309 char *fs_type; /* rw, ro, sw, or xx */ 310 int fs_freq; /* dump frequency, in days */ 311 int fs_passno; /* pass number on parallel fsck */ 312}; 313.Ed 314.Pp 315The proper way to read records from 316.Pa fstab 317is to use the routines 318.Xr getfsent 3 , 319.Xr getfsspec 3 , 320and 321.Xr getfsfile 3 . 322.Sh FILES 323.Bl -tag -width /etc/fstab 324.It Pa /etc/fstab 325The location of 326.Nm 327configuration file. 328.It Pa /usr/share/examples/fstab/ 329Some useful configuration examples. 330.El 331.Sh SEE ALSO 332.Xr getfsent 3 , 333.Xr mount 8 , 334.Xr swapctl 8 335.Sh HISTORY 336The 337.Nm 338file format appeared in 339.Bx 4.0 . 340