xref: /freebsd/share/man/man5/fstab.5 (revision 8e6b01171e30297084bb0b4457c4183c2746aacc)
1.\" Copyright (c) 1980, 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
33.\"
34.Dd June 5, 1993
35.Dt FSTAB 5
36.Os BSD 4
37.Sh NAME
38.Nm fstab
39.Nd static information about the filesystems
40.Sh SYNOPSIS
41.Fd #include <fstab.h>
42.Sh DESCRIPTION
43The file
44.Nm fstab
45contains descriptive information about the various file
46systems.
47.Nm fstab
48is only read by programs, and not written;
49it is the duty of the system administrator to properly create
50and maintain this file.
51Each filesystem is described on a separate line;
52fields on each line are separated by tabs or spaces.
53The order of records in
54.Nm fstab
55is important because
56.Xr fsck 8 ,
57.Xr mount 8 ,
58and
59.Xr umount 8
60sequentially iterate through
61.Nm fstab
62doing their thing.
63.Pp
64The first field,
65.Pq Fa fs_spec ,
66describes the block special device or
67remote filesystem to be mounted.
68For filesystems of type
69.Em ufs ,
70the special file name is the block special file name,
71and not the character special file name.
72If a program needs the character special file name,
73the program must create it by appending a ``r'' after the
74last ``/'' in the special file name.
75.Pp
76The second field,
77.Pq Fa fs_file ,
78describes the mount point for the filesystem.
79For swap partitions, this field should be specified as ``none''.
80.Pp
81The third field,
82.Pq Fa fs_vfstype ,
83describes the type of the filesystem.
84The system currently supports four types of filesystems:
85.Bl -tag -width indent -offset indent
86.It Em ufs
87a local
88.Tn UNIX
89filesystem
90.It Em mfs
91a local memory-based
92.Tn UNIX
93filesystem
94.It Em nfs
95a Sun Microsystems compatible ``Network File System''
96.It Em swap
97a disk partition to be used for swapping
98.El
99.Pp
100The fourth field,
101.Pq Fa fs_mntops ,
102describes the mount options associated with the filesystem.
103It is formatted as a comma separated list of options.
104It contains at least the type of mount (see
105.Fa fs_type
106below) plus any additional options
107appropriate to the filesystem type.
108.Pp
109If the options ``userquota'' and/or ``groupquota'' are specified,
110the filesystem is automatically processed by the
111.Xr quotacheck 8
112command, and user and/or group disk quotas are enabled with
113.Xr quotaon 8 .
114By default,
115filesystem quotas are maintained in files named
116.Pa quota.user
117and
118.Pa quota.group
119which are located at the root of the associated filesystem.
120These defaults may be overridden by putting an equal sign
121and an alternative absolute pathname following the quota option.
122Thus, if the user quota file for
123.Pa /tmp
124is stored in
125.Pa /var/quotas/tmp.user ,
126this location can be specified as:
127.Bd -literal -offset indent
128userquota=/var/quotas/tmp.user
129.Ed
130.Pp
131If the option ``noauto'' is specified, the filesystem will not be automatically
132mounted at system startup.
133.Pp
134The type of the mount is extracted from the
135.Fa fs_mntops
136field and stored separately in the
137.Fa fs_type
138field (it is not deleted from the
139.Fa fs_mntops
140field).
141If
142.Fa fs_type
143is ``rw'' or ``ro'' then the filesystem whose name is given in the
144.Fa fs_file
145field is normally mounted read-write or read-only on the
146specified special file.
147If
148.Fa fs_type
149is ``sw'' then the special file is made available as a piece of swap
150space by the
151.Xr swapon 8
152command at the end of the system reboot procedure.
153The fields other than
154.Fa fs_spec
155and
156.Fa fs_type
157are unused.
158If
159.Fa fs_type
160is specified as ``xx'' the entry is ignored.
161This is useful to show disk partitions which are currently unused.
162.Pp
163The fifth field,
164.Pq Fa fs_freq ,
165is used for these filesystems by the
166.Xr dump 8
167command to determine which filesystems need to be dumped.
168If the fifth field is not present, a value of zero is returned and
169.Xr dump
170will assume that the filesystem does not need to be dumped.
171.Pp
172The sixth field,
173.Pq Fa fs_passno ,
174is used by the
175.Xr fsck 8
176program to determine the order in which filesystem checks are done
177at reboot time.
178The root filesystem should be specified with a
179.Fa fs_passno
180of 1, and other filesystems should have a
181.Fa fs_passno
182of 2.
183Filesystems within a drive will be checked sequentially,
184but filesystems on different drives will be checked at the
185same time to utilize parallelism available in the hardware.
186If the sixth field is not present or zero,
187a value of zero is returned and
188.Xr fsck
189will assume that the filesystem does not need to be checked.
190.Bd -literal
191#define	FSTAB_RW	"rw"	/* read-write device */
192#define	FSTAB_RO	"ro"	/* read-only device */
193#define	FSTAB_SW	"sw"	/* swap device */
194#define	FSTAB_XX	"xx"	/* ignore totally */
195
196struct fstab {
197	char	*fs_spec;	/* block special device name */
198	char	*fs_file;	/* filesystem path prefix */
199	char	*fs_vfstype;	/* type of filesystem */
200	char	*fs_mntops;	/* comma separated mount options */
201	char	*fs_type;	/* rw, ro, sw, or xx */
202	int	fs_freq;	/* dump frequency, in days */
203	int	fs_passno;	/* pass number on parallel dump */
204};
205.Ed
206.Pp
207The proper way to read records from
208.Pa fstab
209is to use the routines
210.Xr getfsent 3 ,
211.Xr getfsspec 3 ,
212.Xr getfstype 3 ,
213and
214.Xr getfsfile 3 .
215.Sh FILES
216.Bl -tag -width /etc/fstab -compact
217.It Pa /etc/fstab
218The file
219.Nm fstab
220resides in
221.Pa /etc .
222.El
223.Sh SEE ALSO
224.Xr getfsent 3
225.Sh HISTORY
226The
227.Nm
228file format appeared in
229.Bx 4.0 .
230