xref: /csrg-svn/share/man/man5/fstab.5 (revision 61609)
1*61609Sbostic.\" Copyright (c) 1980, 1989, 1991, 1993
2*61609Sbostic.\"	The Regents of the University of California.  All rights reserved.
320761Smckusick.\"
449642Scael.\" %sccs.include.redist.roff%
520761Smckusick.\"
6*61609Sbostic.\"     @(#)fstab.5	8.1 (Berkeley) 06/05/93
738673Smckusick.\"
849642Scael.Dd
949642Scael.Dt FSTAB 5
1049642Scael.Os BSD 4
1149642Scael.Sh NAME
1249642Scael.Nm fstab
1349642Scael.Nd static information about the filesystems
1449642Scael.Sh SYNOPSIS
1549642Scael.Fd #include <fstab.h>
1649642Scael.Sh DESCRIPTION
1720761SmckusickThe file
1849642Scael.Nm fstab
1920761Smckusickcontains descriptive information about the various file
2020761Smckusicksystems.
2149642Scael.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
2849642Scael.Nm fstab
2920762Smckusickis important because
3049642Scael.Xr fsck 8 ,
3149642Scael.Xr mount 8 ,
3220761Smckusickand
3349642Scael.Xr umount 8
3420761Smckusicksequentially iterate through
3549642Scael.Nm fstab
3620761Smckusickdoing their thing.
3749642Scael.Pp
3849642ScaelThe first field,
3949642Scael.Pq Fa fs_spec ,
4038673Smckusickdescribes the block special device or
4141427Smckusickremote filesystem to be mounted.
4241427SmckusickFor filesystems of type
4349642Scael.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.
4949642Scael.Pp
5049642ScaelThe second field,
5149642Scael.Pq Fa fs_file ,
5241427Smckusickdescribes the mount point for the filesystem.
5338673SmckusickFor swap partitions, this field should be specified as ``none''.
5449642Scael.Pp
5549642ScaelThe third field,
5649642Scael.Pq Fa fs_vfstype ,
5741427Smckusickdescribes the type of the filesystem.
5841427SmckusickThe system currently supports four types of filesystems:
5949642Scael.Bl -tag -width indent -offset indent
6049642Scael.It Em ufs
6149642Scaela local
6249642Scael.Tn UNIX
6349642Scaelfilesystem
6449642Scael.It Em mfs
6549642Scaela local memory-based
6649642Scael.Tn UNIX
6749642Scaelfilesystem
6849642Scael.It Em nfs
6941427Smckusicka Sun Microsystems compatible ``Network File System''
7049642Scael.It Em swap
7138673Smckusicka disk partition to be used for swapping
7249642Scael.El
7349642Scael.Pp
7449642ScaelThe fourth field,
7549642Scael.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
7949642Scael.Fa fs_type
8038673Smckusickbelow) plus any additional options
8141427Smckusickappropriate to the filesystem type.
8249642Scael.Pp
8341427SmckusickIf the options ``userquota'' and/or ``groupquota'' are specified,
8441427Smckusickthe filesystem is automatically processed by the
8549642Scael.Xr quotacheck 8
8641427Smckusickcommand, and user and/or group disk quotas are enabled with
8749642Scael.Xr quotaon 8 .
8841427SmckusickBy default,
8941427Smckusickfilesystem quotas are maintained in files named
9049642Scael.Pa quota.user
9141427Smckusickand
9249642Scael.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.
9649642ScaelThus, if the user quota file for
9749642Scael.Pa /tmp
9849642Scaelis stored in
9949642Scael.Pa /var/quotas/tmp.user ,
10041427Smckusickthis location can be specified as:
10149642Scael.Bd -literal -offset indent
10249642Scaeluserquota=/var/quotas/tmp.user
10349642Scael.Ed
10449642Scael.Pp
10538673SmckusickThe type of the mount is extracted from the
10649642Scael.Fa fs_mntops
10738673Smckusickfield and stored separately in the
10849642Scael.Fa fs_type
10938673Smckusickfield (it is not deleted from the
11049642Scael.Fa fs_mntops
11138673Smckusickfield).
11220761SmckusickIf
11349642Scael.Fa fs_type
11441427Smckusickis ``rw'' or ``ro'' then the filesystem whose name is given in the
11549642Scael.Fa fs_file
11620762Smckusickfield is normally mounted read-write or read-only on the
11741427Smckusickspecified special file.
11820761SmckusickIf
11949642Scael.Fa fs_type
12020762Smckusickis ``sw'' then the special file is made available as a piece of swap
12120761Smckusickspace by the
12249642Scael.Xr swapon 8
12320761Smckusickcommand at the end of the system reboot procedure.
12420761SmckusickThe fields other than
12549642Scael.Fa fs_spec
12620761Smckusickand
12749642Scael.Fa fs_type
12838673Smckusickare unused.
12920762SmckusickIf
13049642Scael.Fa fs_type
13138673Smckusickis specified as ``xx'' the entry is ignored.
13238673SmckusickThis is useful to show disk partitions which are currently unused.
13349642Scael.Pp
13449642ScaelThe fifth field,
13549642Scael.Pq Fa fs_freq ,
13641427Smckusickis used for these filesystems by the
13749642Scael.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
14049642Scael.Xr dump
14141427Smckusickwill assume that the filesystem does not need to be dumped.
14249642Scael.Pp
14349642ScaelThe sixth field,
14449642Scael.Pq Fa fs_passno ,
14538673Smckusickis used by the
14649642Scael.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
15049642Scael.Fa fs_passno
15141427Smckusickof 1, and other filesystems should have a
15249642Scael.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
15949642Scael.Xr fsck
16041427Smckusickwill assume that the filesystem does not need to be checked.
16149642Scael.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 */
16649642Scael
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};
17649642Scael.Ed
17749642Scael.Pp
17820761SmckusickThe proper way to read records from
17949642Scael.Pa fstab
18049642Scaelis to use the routines
18149642Scael.Xr getfsent 3 ,
18249642Scael.Xr getfsspec 3 ,
18349642Scael.Xr getfstype 3 ,
18449642Scaeland
18549642Scael.Xr getfsfile 3 .
18649642Scael.Sh FILES
18749642Scael.Bl -tag -width /etc/fstab -compact
18849642Scael.It Pa /etc/fstab
18949642ScaelThe file
19049642Scael.Nm fstab
19149642Scaelresides in
19249642Scael.Pa /etc .
19349642Scael.El
19449642Scael.Sh SEE ALSO
19549642Scael.Xr getfsent 3
19649642Scael.Sh HISTORY
19749642ScaelThe
19849642Scael.Nm
19949642Scaelfile format appeared in
20049642Scael.Bx 4.0 .
201