xref: /freebsd/share/man/man5/fstab.5 (revision 3e0f6b97b257a96f7275e4442204263e44b16686)
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 can support various filesystem types.
85Only the root, /usr, and /tmp filesystems need be statically
86compiled into the kernel;
87everything else will be automatically loaded at mount
88time.  (Exception: the UFS family - FFS, MFS, and LFS cannot
89currently be demand-loaded.)  Some people still prefer to statically
90compile other filesystems as well.
91
92.Bl -tag -width indent -offset indent
93.It Em ufs
94a local
95.Tn UNIX
96filesystem
97.It Em mfs
98a local memory-based
99.Tn UNIX
100filesystem
101.It Em nfs
102a Sun Microsystems compatible ``Network File System''
103.It Em swap
104a disk partition to be used for swapping
105.It Em msdos
106a DOS compatible filesystem
107.It Em isofs
108a CD-ROM filesystem (as per ISO 9660)
109.\" maybe also say Rock Ridge extensions are handled ?
110.It Em procfs
111a file system for accessing process data
112.It Em kernfs
113a file system for accessing kernel parameter
114.El
115.Pp
116The fourth field,
117.Pq Fa fs_mntops ,
118describes the mount options associated with the filesystem.
119It is formatted as a comma separated list of options.
120It contains at least the type of mount (see
121.Fa fs_type
122below) plus any additional options
123appropriate to the filesystem type.
124.Pp
125If the options ``userquota'' and/or ``groupquota'' are specified,
126the filesystem is automatically processed by the
127.Xr quotacheck 8
128command, and user and/or group disk quotas are enabled with
129.Xr quotaon 8 .
130By default,
131filesystem quotas are maintained in files named
132.Pa quota.user
133and
134.Pa quota.group
135which are located at the root of the associated filesystem.
136These defaults may be overridden by putting an equal sign
137and an alternative absolute pathname following the quota option.
138Thus, if the user quota file for
139.Pa /tmp
140is stored in
141.Pa /var/quotas/tmp.user ,
142this location can be specified as:
143.Bd -literal -offset indent
144userquota=/var/quotas/tmp.user
145.Ed
146.Pp
147If the option ``noauto'' is specified, the filesystem will not be automatically
148mounted at system startup.
149.Pp
150The type of the mount is extracted from the
151.Fa fs_mntops
152field and stored separately in the
153.Fa fs_type
154field (it is not deleted from the
155.Fa fs_mntops
156field).
157If
158.Fa fs_type
159is ``rw'' or ``ro'' then the filesystem whose name is given in the
160.Fa fs_file
161field is normally mounted read-write or read-only on the
162specified special file.
163If
164.Fa fs_type
165is ``sw'' then the special file is made available as a piece of swap
166space by the
167.Xr swapon 8
168command at the end of the system reboot procedure.
169The fields other than
170.Fa fs_spec
171and
172.Fa fs_type
173are unused.
174If
175.Fa fs_type
176is specified as ``xx'' the entry is ignored.
177This is useful to show disk partitions which are currently unused.
178.Pp
179The fifth field,
180.Pq Fa fs_freq ,
181is used for these filesystems by the
182.Xr dump 8
183command to determine which filesystems need to be dumped.
184If the fifth field is not present, a value of zero is returned and
185.Nm dump
186will assume that the filesystem does not need to be dumped.
187.Pp
188The sixth field,
189.Pq Fa fs_passno ,
190is used by the
191.Xr fsck 8
192program to determine the order in which filesystem checks are done
193at reboot time.
194The root filesystem should be specified with a
195.Fa fs_passno
196of 1, and other filesystems should have a
197.Fa fs_passno
198of 2.
199Filesystems within a drive will be checked sequentially,
200but filesystems on different drives will be checked at the
201same time to utilize parallelism available in the hardware.
202If the sixth field is not present or zero,
203a value of zero is returned and
204.Xr fsck 8
205will assume that the filesystem does not need to be checked.
206.Bd -literal
207#define	FSTAB_RW	"rw"	/* read/write device */
208#define	FSTAB_RQ	"rq"	/* read/write with quotas */
209#define	FSTAB_RO	"ro"	/* read-only device */
210#define	FSTAB_SW	"sw"	/* swap device */
211#define	FSTAB_XX	"xx"	/* ignore totally */
212
213struct fstab {
214	char	*fs_spec;	/* block special device name */
215	char	*fs_file;	/* filesystem path prefix */
216	char	*fs_vfstype;	/* File system type, ufs, nfs */
217	char	*fs_mntops;	/* Mount options ala -o */
218	char	*fs_type;	/* FSTAB_* from fs_mntops */
219	int	fs_freq;	/* dump frequency, in days */
220	int	fs_passno;	/* pass number on parallel fsck */
221};
222.Ed
223.Pp
224The proper way to read records from
225.Pa fstab
226is to use the routines
227.Xr getfsent 3 ,
228.Xr getfsspec 3 ,
229.Xr getfstype 3 ,
230and
231.Xr getfsfile 3 .
232.Sh FILES
233.Bl -tag -width /etc/fstab -compact
234.It Pa /etc/fstab
235The file
236.Nm fstab
237resides in
238.Pa /etc .
239.El
240.Sh SEE ALSO
241.Xr getfsent 3 ,
242.Xr getvfsbyname 3 ,
243.Xr dump 8 ,
244.Xr fsck 8 ,
245.Xr mount 8 ,
246.Xr quotacheck 8 ,
247.Xr quotaon 8 ,
248.Xr swapon 8 ,
249.Xr umount 8 .
250.Sh HISTORY
251The
252.Nm
253file format appeared in
254.Bx 4.0 .
255