xref: /original-bsd/share/man/man5/fstab.5 (revision c3e32dec)
1.\" Copyright (c) 1980, 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)fstab.5	8.1 (Berkeley) 06/05/93
7.\"
8.Dd
9.Dt FSTAB 5
10.Os BSD 4
11.Sh NAME
12.Nm fstab
13.Nd static information about the filesystems
14.Sh SYNOPSIS
15.Fd #include <fstab.h>
16.Sh DESCRIPTION
17The file
18.Nm fstab
19contains descriptive information about the various file
20systems.
21.Nm fstab
22is only read by programs, and not written;
23it is the duty of the system administrator to properly create
24and maintain this file.
25Each filesystem is described on a separate line;
26fields on each line are separated by tabs or spaces.
27The order of records in
28.Nm fstab
29is important because
30.Xr fsck 8 ,
31.Xr mount 8 ,
32and
33.Xr umount 8
34sequentially iterate through
35.Nm fstab
36doing their thing.
37.Pp
38The first field,
39.Pq Fa fs_spec ,
40describes the block special device or
41remote filesystem to be mounted.
42For filesystems of type
43.Em ufs ,
44the special file name is the block special file name,
45and not the character special file name.
46If a program needs the character special file name,
47the program must create it by appending a ``r'' after the
48last ``/'' in the special file name.
49.Pp
50The second field,
51.Pq Fa fs_file ,
52describes the mount point for the filesystem.
53For swap partitions, this field should be specified as ``none''.
54.Pp
55The third field,
56.Pq Fa fs_vfstype ,
57describes the type of the filesystem.
58The system currently supports four types of filesystems:
59.Bl -tag -width indent -offset indent
60.It Em ufs
61a local
62.Tn UNIX
63filesystem
64.It Em mfs
65a local memory-based
66.Tn UNIX
67filesystem
68.It Em nfs
69a Sun Microsystems compatible ``Network File System''
70.It Em swap
71a disk partition to be used for swapping
72.El
73.Pp
74The fourth field,
75.Pq Fa fs_mntops ,
76describes the mount options associated with the filesystem.
77It is formatted as a comma separated list of options.
78It contains at least the type of mount (see
79.Fa fs_type
80below) plus any additional options
81appropriate to the filesystem type.
82.Pp
83If the options ``userquota'' and/or ``groupquota'' are specified,
84the filesystem is automatically processed by the
85.Xr quotacheck 8
86command, and user and/or group disk quotas are enabled with
87.Xr quotaon 8 .
88By default,
89filesystem quotas are maintained in files named
90.Pa quota.user
91and
92.Pa quota.group
93which are located at the root of the associated filesystem.
94These defaults may be overridden by putting an equal sign
95and an alternative absolute pathname following the quota option.
96Thus, if the user quota file for
97.Pa /tmp
98is stored in
99.Pa /var/quotas/tmp.user ,
100this location can be specified as:
101.Bd -literal -offset indent
102userquota=/var/quotas/tmp.user
103.Ed
104.Pp
105The type of the mount is extracted from the
106.Fa fs_mntops
107field and stored separately in the
108.Fa fs_type
109field (it is not deleted from the
110.Fa fs_mntops
111field).
112If
113.Fa fs_type
114is ``rw'' or ``ro'' then the filesystem whose name is given in the
115.Fa fs_file
116field is normally mounted read-write or read-only on the
117specified special file.
118If
119.Fa fs_type
120is ``sw'' then the special file is made available as a piece of swap
121space by the
122.Xr swapon 8
123command at the end of the system reboot procedure.
124The fields other than
125.Fa fs_spec
126and
127.Fa fs_type
128are unused.
129If
130.Fa fs_type
131is specified as ``xx'' the entry is ignored.
132This is useful to show disk partitions which are currently unused.
133.Pp
134The fifth field,
135.Pq Fa fs_freq ,
136is used for these filesystems by the
137.Xr dump 8
138command to determine which filesystems need to be dumped.
139If the fifth field is not present, a value of zero is returned and
140.Xr dump
141will assume that the filesystem does not need to be dumped.
142.Pp
143The sixth field,
144.Pq Fa fs_passno ,
145is used by the
146.Xr fsck 8
147program to determine the order in which filesystem checks are done
148at reboot time.
149The root filesystem should be specified with a
150.Fa fs_passno
151of 1, and other filesystems should have a
152.Fa fs_passno
153of 2.
154Filesystems within a drive will be checked sequentially,
155but filesystems on different drives will be checked at the
156same time to utilize parallelism available in the hardware.
157If the sixth field is not present or zero,
158a value of zero is returned and
159.Xr fsck
160will assume that the filesystem does not need to be checked.
161.Bd -literal
162#define	FSTAB_RW	"rw"	/* read-write device */
163#define	FSTAB_RO	"ro"	/* read-only device */
164#define	FSTAB_SW	"sw"	/* swap device */
165#define	FSTAB_XX	"xx"	/* ignore totally */
166
167struct fstab {
168	char	*fs_spec;	/* block special device name */
169	char	*fs_file;	/* filesystem path prefix */
170	char	*fs_vfstype;	/* type of filesystem */
171	char	*fs_mntops;	/* comma separated mount options */
172	char	*fs_type;	/* rw, ro, sw, or xx */
173	int	fs_freq;	/* dump frequency, in days */
174	int	fs_passno;	/* pass number on parallel dump */
175};
176.Ed
177.Pp
178The proper way to read records from
179.Pa fstab
180is to use the routines
181.Xr getfsent 3 ,
182.Xr getfsspec 3 ,
183.Xr getfstype 3 ,
184and
185.Xr getfsfile 3 .
186.Sh FILES
187.Bl -tag -width /etc/fstab -compact
188.It Pa /etc/fstab
189The file
190.Nm fstab
191resides in
192.Pa /etc .
193.El
194.Sh SEE ALSO
195.Xr getfsent 3
196.Sh HISTORY
197The
198.Nm
199file format appeared in
200.Bx 4.0 .
201