xref: /freebsd/share/man/man5/fstab.5 (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
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.\" $FreeBSD$
34.\"
35.Dd February 11, 2008
36.Dt FSTAB 5
37.Os
38.Sh NAME
39.Nm fstab
40.Nd static information about the file systems
41.Sh SYNOPSIS
42.In fstab.h
43.Sh DESCRIPTION
44The file
45.Nm
46contains descriptive information about the various file
47systems.
48.Nm
49is only read by programs, and not written;
50it is the duty of the system administrator to properly create
51and maintain this file.
52Each file system is described on a separate line;
53fields on each line are separated by tabs or spaces.
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 thing.
64.Pp
65The first field,
66.Pq Fa fs_spec ,
67describes the special device or
68remote file system to be mounted.
69.Pp
70The second field,
71.Pq Fa fs_file ,
72describes the mount point for the file system.
73For swap partitions, this field should be specified as ``none''.
74.Pp
75The third field,
76.Pq Fa fs_vfstype ,
77describes the type of the file system.
78The system can support various file system types.
79Only the root, /usr, and /tmp file systems need be statically
80compiled into the kernel;
81everything else will be automatically loaded at mount
82time.
83(Exception: the UFS family - FFS and LFS cannot
84currently be demand-loaded.)
85Some people still prefer to statically
86compile other file systems as well.
87.Pp
88The fourth field,
89.Pq Fa fs_mntops ,
90describes the mount options associated with the file system.
91It is formatted as a comma separated list of options.
92It contains at least the type of mount (see
93.Fa fs_type
94below) plus any additional options
95appropriate to the file system type.
96See the options flag
97.Pq Fl o
98in the
99.Xr mount 8
100page and the file system specific page, such as
101.Xr mount_nfs 8 ,
102for additional options that may be specified.
103.Pp
104If the options ``userquota'' and/or ``groupquota'' are specified,
105the file system is automatically processed by the
106.Xr quotacheck 8
107command, and user and/or group disk quotas are enabled with
108.Xr quotaon 8 .
109By default,
110file system quotas are maintained in files named
111.Pa quota.user
112and
113.Pa quota.group
114which are located at the root of the associated file system.
115These defaults may be overridden by putting an equal sign
116and an alternative absolute pathname following the quota option.
117Thus, if the user quota file for
118.Pa /tmp
119is stored in
120.Pa /var/quotas/tmp.user ,
121this location can be specified as:
122.Bd -literal -offset indent
123userquota=/var/quotas/tmp.user
124.Ed
125.Pp
126If the option ``noauto'' is specified, the file system will not be automatically
127mounted at system startup.
128Note that, for network file systems
129of third party types
130(i.e., types supported by additional software
131not included in the base system)
132to be automatically mounted at system startup,
133the
134.Va extra_netfs_types
135.Xr rc.conf 5
136variable must be used to extend the
137.Xr rc 8
138startup script's list of network file system types.
139.Pp
140The type of the mount is extracted from the
141.Fa fs_mntops
142field and stored separately in the
143.Fa fs_type
144field (it is not deleted from the
145.Fa fs_mntops
146field).
147If
148.Fa fs_type
149is ``rw'' or ``ro'' then the file system whose name is given in the
150.Fa fs_file
151field is normally mounted read-write or read-only on the
152specified special file.
153If
154.Fa fs_type
155is ``sw'' then the special file is made available as a piece of swap
156space by the
157.Xr swapon 8
158command at the end of the system reboot procedure.
159The fields other than
160.Fa fs_spec
161and
162.Fa fs_type
163are unused.
164If
165.Fa fs_type
166is specified as ``xx'' the entry is ignored.
167This is useful to show disk partitions which are currently unused.
168.Pp
169The fifth field,
170.Pq Fa fs_freq ,
171is used for these file systems by the
172.Xr dump 8
173command to determine which file systems need to be dumped.
174If the fifth field is not present, a value of zero is returned and
175.Nm dump
176will assume that the file system does not need to be dumped.
177.Pp
178The sixth field,
179.Pq Fa fs_passno ,
180is used by the
181.Xr fsck 8
182and
183.Xr quotacheck 8
184programs to determine the order in which file system and quota
185checks are done at reboot time.
186The
187.Fa fs_passno
188field can be any value between 0 and
189.Ql INT_MAX Ns -1 .
190.Pp
191The root file system should be specified with a
192.Fa fs_passno
193of 1, and other file systems should have a
194.Fa fs_passno
195of 2 or greater.
196A file system with a
197.Fa fs_passno
198value of 1 is always checked sequentially and be completed before
199another file system is processed, and it will be processed before
200all file systems with a larger
201.Fa fs_passno .
202.Pp
203For any given value of
204.Fa fs_passno ,
205file systems within a drive will be checked sequentially,
206but file systems on different drives will be checked at the
207same time to utilize parallelism available in the hardware.
208Once all file system checks are complete for the current
209.Fa fs_passno ,
210the same process will start over for the next
211.Fa fs_passno .
212.Pp
213If the sixth field is not present or is zero,
214a value of zero is returned and
215.Xr fsck 8
216and
217.Xr quotacheck 8
218will assume that the file system does not need to be checked.
219.Pp
220The
221.Fa fs_passno
222field can be used to implement finer control when
223the system utilities may determine that the file system resides
224on a different physical device, when it actually does not, as with a
225.Xr ccd 4
226device.
227All file systems with a lower
228.Fa fs_passno
229value will be completed before starting on file systems with a
230higher
231.Fa fs_passno
232value.
233E.g. all file systems with a
234.Fa fs_passno
235of 2 will be completed before any file systems with a
236.Fa fs_passno
237of 3 or greater are started.
238Gaps are allowed between the different
239.Fa fs_passno
240values.
241E.g. file systems listed in
242.Pa /etc/fstab
243may have
244.Fa fs_passno
245values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order
246within
247.Pa /etc/fstab .
248.Bd -literal
249#define	FSTAB_RW	"rw"	/* read/write device */
250#define	FSTAB_RQ	"rq"	/* read/write with quotas */
251#define	FSTAB_RO	"ro"	/* read-only device */
252#define	FSTAB_SW	"sw"	/* swap device */
253#define	FSTAB_XX	"xx"	/* ignore totally */
254
255struct fstab {
256	char	*fs_spec;	/* block special device name */
257	char	*fs_file;	/* file system path prefix */
258	char	*fs_vfstype;	/* File system type, ufs, nfs */
259	char	*fs_mntops;	/* Mount options ala -o */
260	char	*fs_type;	/* FSTAB_* from fs_mntops */
261	int	fs_freq;	/* dump frequency, in days */
262	int	fs_passno;	/* pass number on parallel fsck */
263};
264.Ed
265.Pp
266The proper way to read records from
267.Pa fstab
268is to use the routines
269.Xr getfsent 3 ,
270.Xr getfsspec 3 ,
271.Xr getfstype 3 ,
272and
273.Xr getfsfile 3 .
274.Sh FILES
275.Bl -tag -width /etc/fstab -compact
276.It Pa /etc/fstab
277The file
278.Nm
279resides in
280.Pa /etc .
281.El
282.Sh SEE ALSO
283.Xr getfsent 3 ,
284.Xr getvfsbyname 3 ,
285.Xr ccd 4 ,
286.Xr dump 8 ,
287.Xr fsck 8 ,
288.Xr mount 8 ,
289.Xr quotacheck 8 ,
290.Xr quotaon 8 ,
291.Xr swapon 8 ,
292.Xr umount 8
293.Sh HISTORY
294The
295.Nm
296file format appeared in
297.Bx 4.0 .
298