1*49642Scael.\" Copyright (c) 1980, 1989, 1991 The Regents of the University of California. 238673Smckusick.\" All rights reserved. 320761Smckusick.\" 4*49642Scael.\" %sccs.include.redist.roff% 520761Smckusick.\" 6*49642Scael.\" @(#)fstab.5 6.5 (Berkeley) 05/10/91 738673Smckusick.\" 8*49642Scael.Dd 9*49642Scael.Dt FSTAB 5 10*49642Scael.Os BSD 4 11*49642Scael.Sh NAME 12*49642Scael.Nm fstab 13*49642Scael.Nd static information about the filesystems 14*49642Scael.Sh SYNOPSIS 15*49642Scael.Fd #include <fstab.h> 16*49642Scael.Sh DESCRIPTION 1720761SmckusickThe file 18*49642Scael.Nm fstab 1920761Smckusickcontains descriptive information about the various file 2020761Smckusicksystems. 21*49642Scael.Nm fstab 2238673Smckusickis only read by programs, and not written; 2320761Smckusickit is the duty of the system administrator to properly create 2420761Smckusickand maintain this file. 2541427SmckusickEach filesystem is described on a separate line; 2638673Smckusickfields on each line are separated by tabs or spaces. 2720761SmckusickThe order of records in 28*49642Scael.Nm fstab 2920762Smckusickis important because 30*49642Scael.Xr fsck 8 , 31*49642Scael.Xr mount 8 , 3220761Smckusickand 33*49642Scael.Xr umount 8 3420761Smckusicksequentially iterate through 35*49642Scael.Nm fstab 3620761Smckusickdoing their thing. 37*49642Scael.Pp 38*49642ScaelThe first field, 39*49642Scael.Pq Fa fs_spec , 4038673Smckusickdescribes the block special device or 4141427Smckusickremote filesystem to be mounted. 4241427SmckusickFor filesystems of type 43*49642Scael.Em ufs , 4438673Smckusickthe special file name is the block special file name, 4520761Smckusickand not the character special file name. 4620761SmckusickIf a program needs the character special file name, 4720761Smckusickthe program must create it by appending a ``r'' after the 4820761Smckusicklast ``/'' in the special file name. 49*49642Scael.Pp 50*49642ScaelThe second field, 51*49642Scael.Pq Fa fs_file , 5241427Smckusickdescribes the mount point for the filesystem. 5338673SmckusickFor swap partitions, this field should be specified as ``none''. 54*49642Scael.Pp 55*49642ScaelThe third field, 56*49642Scael.Pq Fa fs_vfstype , 5741427Smckusickdescribes the type of the filesystem. 5841427SmckusickThe system currently supports four types of filesystems: 59*49642Scael.Bl -tag -width indent -offset indent 60*49642Scael.It Em ufs 61*49642Scaela local 62*49642Scael.Tn UNIX 63*49642Scaelfilesystem 64*49642Scael.It Em mfs 65*49642Scaela local memory-based 66*49642Scael.Tn UNIX 67*49642Scaelfilesystem 68*49642Scael.It Em nfs 6941427Smckusicka Sun Microsystems compatible ``Network File System'' 70*49642Scael.It Em swap 7138673Smckusicka disk partition to be used for swapping 72*49642Scael.El 73*49642Scael.Pp 74*49642ScaelThe fourth field, 75*49642Scael.Pq Fa fs_mntops , 7641427Smckusickdescribes the mount options associated with the filesystem. 7738673SmckusickIt is formatted as a comma separated list of options. 7838673SmckusickIt contains at least the type of mount (see 79*49642Scael.Fa fs_type 8038673Smckusickbelow) plus any additional options 8141427Smckusickappropriate to the filesystem type. 82*49642Scael.Pp 8341427SmckusickIf the options ``userquota'' and/or ``groupquota'' are specified, 8441427Smckusickthe filesystem is automatically processed by the 85*49642Scael.Xr quotacheck 8 8641427Smckusickcommand, and user and/or group disk quotas are enabled with 87*49642Scael.Xr quotaon 8 . 8841427SmckusickBy default, 8941427Smckusickfilesystem quotas are maintained in files named 90*49642Scael.Pa quota.user 9141427Smckusickand 92*49642Scael.Pa quota.group 9341427Smckusickwhich are located at the root of the associated filesystem. 9441427SmckusickThese defaults may be overridden by putting an equal sign 9541427Smckusickand an alternative absolute pathname following the quota option. 96*49642ScaelThus, if the user quota file for 97*49642Scael.Pa /tmp 98*49642Scaelis stored in 99*49642Scael.Pa /var/quotas/tmp.user , 10041427Smckusickthis location can be specified as: 101*49642Scael.Bd -literal -offset indent 102*49642Scaeluserquota=/var/quotas/tmp.user 103*49642Scael.Ed 104*49642Scael.Pp 10538673SmckusickThe type of the mount is extracted from the 106*49642Scael.Fa fs_mntops 10738673Smckusickfield and stored separately in the 108*49642Scael.Fa fs_type 10938673Smckusickfield (it is not deleted from the 110*49642Scael.Fa fs_mntops 11138673Smckusickfield). 11220761SmckusickIf 113*49642Scael.Fa fs_type 11441427Smckusickis ``rw'' or ``ro'' then the filesystem whose name is given in the 115*49642Scael.Fa fs_file 11620762Smckusickfield is normally mounted read-write or read-only on the 11741427Smckusickspecified special file. 11820761SmckusickIf 119*49642Scael.Fa fs_type 12020762Smckusickis ``sw'' then the special file is made available as a piece of swap 12120761Smckusickspace by the 122*49642Scael.Xr swapon 8 12320761Smckusickcommand at the end of the system reboot procedure. 12420761SmckusickThe fields other than 125*49642Scael.Fa fs_spec 12620761Smckusickand 127*49642Scael.Fa fs_type 12838673Smckusickare unused. 12920762SmckusickIf 130*49642Scael.Fa fs_type 13138673Smckusickis specified as ``xx'' the entry is ignored. 13238673SmckusickThis is useful to show disk partitions which are currently unused. 133*49642Scael.Pp 134*49642ScaelThe fifth field, 135*49642Scael.Pq Fa fs_freq , 13641427Smckusickis used for these filesystems by the 137*49642Scael.Xr dump 8 13841427Smckusickcommand to determine which filesystems need to be dumped. 13938673SmckusickIf the fifth field is not present, a value of zero is returned and 140*49642Scael.Xr dump 14141427Smckusickwill assume that the filesystem does not need to be dumped. 142*49642Scael.Pp 143*49642ScaelThe sixth field, 144*49642Scael.Pq Fa fs_passno , 14538673Smckusickis used by the 146*49642Scael.Xr fsck 8 14741427Smckusickprogram to determine the order in which filesystem checks are done 14838673Smckusickat reboot time. 14941427SmckusickThe root filesystem should be specified with a 150*49642Scael.Fa fs_passno 15141427Smckusickof 1, and other filesystems should have a 152*49642Scael.Fa fs_passno 15341427Smckusickof 2. 15441427SmckusickFilesystems within a drive will be checked sequentially, 15541427Smckusickbut filesystems on different drives will be checked at the 15641427Smckusicksame time to utilize parallelism available in the hardware. 15741427SmckusickIf the sixth field is not present or zero, 15841427Smckusicka value of zero is returned and 159*49642Scael.Xr fsck 16041427Smckusickwill assume that the filesystem does not need to be checked. 161*49642Scael.Bd -literal 16220762Smckusick#define FSTAB_RW "rw" /* read-write device */ 16320762Smckusick#define FSTAB_RO "ro" /* read-only device */ 16420762Smckusick#define FSTAB_SW "sw" /* swap device */ 16520762Smckusick#define FSTAB_XX "xx" /* ignore totally */ 166*49642Scael 16720761Smckusickstruct fstab { 16820762Smckusick char *fs_spec; /* block special device name */ 16941427Smckusick char *fs_file; /* filesystem path prefix */ 17041427Smckusick char *fs_vfstype; /* type of filesystem */ 17138673Smckusick char *fs_mntops; /* comma separated mount options */ 17238673Smckusick char *fs_type; /* rw, ro, sw, or xx */ 17338673Smckusick int fs_freq; /* dump frequency, in days */ 17438673Smckusick int fs_passno; /* pass number on parallel dump */ 17520761Smckusick}; 176*49642Scael.Ed 177*49642Scael.Pp 17820761SmckusickThe proper way to read records from 179*49642Scael.Pa fstab 180*49642Scaelis to use the routines 181*49642Scael.Xr getfsent 3 , 182*49642Scael.Xr getfsspec 3 , 183*49642Scael.Xr getfstype 3 , 184*49642Scaeland 185*49642Scael.Xr getfsfile 3 . 186*49642Scael.Sh FILES 187*49642Scael.Bl -tag -width /etc/fstab -compact 188*49642Scael.It Pa /etc/fstab 189*49642ScaelThe file 190*49642Scael.Nm fstab 191*49642Scaelresides in 192*49642Scael.Pa /etc . 193*49642Scael.El 194*49642Scael.Sh SEE ALSO 195*49642Scael.Xr getfsent 3 196*49642Scael.Sh HISTORY 197*49642ScaelThe 198*49642Scael.Nm 199*49642Scaelfile format appeared in 200*49642Scael.Bx 4.0 . 201