xref: /freebsd/share/man/man5/fstab.5 (revision adeb92a24c57f97d5cd3c3c45be239cbb23aed68)
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 June 5, 1993
36.Dt FSTAB 5
37.Os
38.Sh NAME
39.Nm fstab
40.Nd static information about the filesystems
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 filesystem 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 block special device or
68remote filesystem to be mounted.
69For filesystems of type
70.Em ufs ,
71the special file name is the block special file name,
72and not the character special file name.
73If a program needs the character special file name,
74the program must create it by appending a ``r'' after the
75last ``/'' in the special file name.
76.Pp
77The second field,
78.Pq Fa fs_file ,
79describes the mount point for the filesystem.
80For swap partitions, this field should be specified as ``none''.
81.Pp
82The third field,
83.Pq Fa fs_vfstype ,
84describes the type of the filesystem.
85The system can support various filesystem types.
86Only the root, /usr, and /tmp filesystems need be statically
87compiled into the kernel;
88everything else will be automatically loaded at mount
89time.  (Exception: the UFS family - FFS and LFS cannot
90currently be demand-loaded.)  Some people still prefer to statically
91compile other filesystems as well.
92.Pp
93The fourth field,
94.Pq Fa fs_mntops ,
95describes the mount options associated with the filesystem.
96It is formatted as a comma separated list of options.
97It contains at least the type of mount (see
98.Fa fs_type
99below) plus any additional options
100appropriate to the filesystem type.  See the options flag
101.Pq Fl o
102in the
103.Xr mount 8
104page and the filesystem specific page, such as
105.Xr mount_nfs 8 ,
106for additional options that may be specified.
107.Pp
108If the options ``userquota'' and/or ``groupquota'' are specified,
109the filesystem is automatically processed by the
110.Xr quotacheck 8
111command, and user and/or group disk quotas are enabled with
112.Xr quotaon 8 .
113By default,
114filesystem quotas are maintained in files named
115.Pa quota.user
116and
117.Pa quota.group
118which are located at the root of the associated filesystem.
119These defaults may be overridden by putting an equal sign
120and an alternative absolute pathname following the quota option.
121Thus, if the user quota file for
122.Pa /tmp
123is stored in
124.Pa /var/quotas/tmp.user ,
125this location can be specified as:
126.Bd -literal -offset indent
127userquota=/var/quotas/tmp.user
128.Ed
129.Pp
130If the option ``noauto'' is specified, the filesystem will not be automatically
131mounted at system startup.
132Note that, for network filesystems
133of third party types
134(i.e. types supported by additional software
135not included in the base system)
136to be automatically mounted at system startup,
137the
138.\" XXX This word is not marked up with .Va because it is not a variable
139.\"     that relates to /etc/fstab, but rather an rc.conf(8) variable.
140.Bk -words
141extra_netfs_types
142.Ek
143.Xr rc.conf 5
144variable must be used to extend the
145.Xr rc 8
146startup script's list of network filesystem types.
147.Pp
148The type of the mount is extracted from the
149.Fa fs_mntops
150field and stored separately in the
151.Fa fs_type
152field (it is not deleted from the
153.Fa fs_mntops
154field).
155If
156.Fa fs_type
157is ``rw'' or ``ro'' then the filesystem whose name is given in the
158.Fa fs_file
159field is normally mounted read-write or read-only on the
160specified special file.
161If
162.Fa fs_type
163is ``sw'' then the special file is made available as a piece of swap
164space by the
165.Xr swapon 8
166command at the end of the system reboot procedure.
167The fields other than
168.Fa fs_spec
169and
170.Fa fs_type
171are unused.
172If
173.Fa fs_type
174is specified as ``xx'' the entry is ignored.
175This is useful to show disk partitions which are currently unused.
176.Pp
177The fifth field,
178.Pq Fa fs_freq ,
179is used for these filesystems by the
180.Xr dump 8
181command to determine which filesystems need to be dumped.
182If the fifth field is not present, a value of zero is returned and
183.Nm dump
184will assume that the filesystem does not need to be dumped.
185.Pp
186The sixth field,
187.Pq Fa fs_passno ,
188is used by the
189.Xr fsck 8
190program to determine the order in which filesystem checks are done
191at reboot time.
192The root filesystem should be specified with a
193.Fa fs_passno
194of 1, and other filesystems should have a
195.Fa fs_passno
196of 2.
197Filesystems within a drive will be checked sequentially,
198but filesystems on different drives will be checked at the
199same time to utilize parallelism available in the hardware.
200If the sixth field is not present or is zero,
201a value of zero is returned and
202.Xr fsck 8
203will assume that the filesystem does not need to be checked.
204.Bd -literal
205#define	FSTAB_RW	"rw"	/* read/write device */
206#define	FSTAB_RQ	"rq"	/* read/write with quotas */
207#define	FSTAB_RO	"ro"	/* read-only device */
208#define	FSTAB_SW	"sw"	/* swap device */
209#define	FSTAB_XX	"xx"	/* ignore totally */
210
211struct fstab {
212	char	*fs_spec;	/* block special device name */
213	char	*fs_file;	/* filesystem path prefix */
214	char	*fs_vfstype;	/* File system type, ufs, nfs */
215	char	*fs_mntops;	/* Mount options ala -o */
216	char	*fs_type;	/* FSTAB_* from fs_mntops */
217	int	fs_freq;	/* dump frequency, in days */
218	int	fs_passno;	/* pass number on parallel fsck */
219};
220.Ed
221.Pp
222The proper way to read records from
223.Pa fstab
224is to use the routines
225.Xr getfsent 3 ,
226.Xr getfsspec 3 ,
227.Xr getfstype 3 ,
228and
229.Xr getfsfile 3 .
230.Sh FILES
231.Bl -tag -width /etc/fstab -compact
232.It Pa /etc/fstab
233The file
234.Nm
235resides in
236.Pa /etc .
237.El
238.Sh SEE ALSO
239.Xr getfsent 3 ,
240.Xr getvfsbyname 3 ,
241.Xr dump 8 ,
242.Xr fsck 8 ,
243.Xr mount 8 ,
244.Xr quotacheck 8 ,
245.Xr quotaon 8 ,
246.Xr swapon 8 ,
247.Xr umount 8
248.Sh HISTORY
249The
250.Nm
251file format appeared in
252.Bx 4.0 .
253