xref: /dragonfly/share/man/man5/fstab.5 (revision f746689a)
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: src/share/man/man5/fstab.5,v 1.11.2.8 2003/02/10 12:21:08 des Exp $
34.\" $DragonFly: src/share/man/man5/fstab.5,v 1.5 2008/07/27 21:16:00 thomas Exp $
35.\"
36.Dd July 27, 2008
37.Dt FSTAB 5
38.Os
39.Sh NAME
40.Nm fstab
41.Nd static information about the file systems
42.Sh SYNOPSIS
43.In fstab.h
44.Sh DESCRIPTION
45The file
46.Nm
47contains descriptive information about the various file
48systems.
49.Nm
50is only read by programs, and not written;
51it is the duty of the system administrator to properly create
52and maintain this file.
53Each file system is described on a separate line;
54fields on each line are separated by tabs or spaces.
55The order of records in
56.Nm
57is important because
58.Xr fsck 8 ,
59.Xr mount 8 ,
60and
61.Xr umount 8
62sequentially iterate through
63.Nm
64doing their thing.
65.Pp
66The first field,
67.Pq Fa fs_spec ,
68describes the special file or
69remote file system to be mounted.
70.Pp
71The second field,
72.Pq Fa fs_file ,
73describes the mount point for the file system.
74For swap partitions, this field should be specified as
75.Dq none .
76.Pp
77The third field,
78.Pq Fa fs_vfstype ,
79describes the type of the file system.
80The system can support various file system types.
81Only the root,
82.Pa /usr ,
83and
84.Pa /tmp
85file systems 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 file systems as well.
91.Pp
92The most common file system types are:
93.Bl -tag -width indent -offset indent
94.It Em HAMMER
95a local
96.Xr HAMMER 5
97file system
98.It Em ufs
99a local
100.Xr ffs 5
101.Ux
102file system
103.It Em mfs
104a local memory-based
105.Ux
106file system
107.It Em nfs
108a Sun Microsystems compatible
109.Dq "Network File System"
110.It Em swap
111a disk partition to be used for swapping
112.It Em msdos
113a local
114.Xr msdos 5
115DOS compatible file system
116.It Em cd9660
117a local CD-ROM file system (as per ISO 9660)
118.\" maybe also say Rock Ridge extensions are handled ?
119.It Em procfs
120a file system for accessing process data
121.El
122.Pp
123The fourth field,
124.Pq Fa fs_mntops ,
125describes the mount options associated with the file system.
126It is formatted as a comma separated list of options.
127It contains at least the type of mount (see
128.Fa fs_type
129below) plus any additional options
130appropriate to the file system type.  See the options flag
131.Pq Fl o
132in the
133.Xr mount 8
134page and the file system specific page, such as
135.Xr mount_nfs 8 ,
136for additional options that may be specified.
137.Pp
138If the options ``userquota'' and/or ``groupquota'' are specified,
139the file system is automatically processed by the
140.Xr quotacheck 8
141command, and user and/or group disk quotas are enabled with
142.Xr quotaon 8 .
143By default,
144file system quotas are maintained in files named
145.Pa quota.user
146and
147.Pa quota.group
148which are located at the root of the associated file system.
149These defaults may be overridden by putting an equal sign
150and an alternative absolute pathname following the quota option.
151Thus, if the user quota file for
152.Pa /tmp
153is stored in
154.Pa /var/quotas/tmp.user ,
155this location can be specified as:
156.Bd -literal -offset indent
157userquota=/var/quotas/tmp.user
158.Ed
159.Pp
160If the option ``noauto'' is specified, the file system will not be automatically
161mounted at system startup.
162This is recommended for all remote file systems other than NFS,
163since only NFS mounts are delayed until after network initialization
164by the
165.Xr rc 8
166startup scripts.
167.Pp
168The type of the mount is extracted from the
169.Fa fs_mntops
170field and stored separately in the
171.Fa fs_type
172field (it is not deleted from the
173.Fa fs_mntops
174field).
175If
176.Fa fs_type
177is ``rw'' or ``ro'' then the file system whose name is given in the
178.Fa fs_file
179field is normally mounted read-write or read-only on the
180specified special file.
181If
182.Fa fs_type
183is ``sw'' then the special file is made available as a piece of swap
184space by the
185.Xr swapon 8
186command at the end of the system reboot procedure.
187The fields other than
188.Fa fs_spec
189and
190.Fa fs_type
191are unused.
192If
193.Fa fs_type
194is specified as ``xx'' the entry is ignored.
195This is useful to show disk partitions which are currently unused.
196.Pp
197The fifth field,
198.Pq Fa fs_freq ,
199is used for these file systems by the
200.Xr dump 8
201command to determine which file systems need to be dumped.
202If the fifth field is not present, a value of zero is returned and
203.Nm dump
204will assume that the file system does not need to be dumped.
205.Pp
206The sixth field,
207.Pq Fa fs_passno ,
208is used by the
209.Xr fsck 8
210program to determine the order in which file system checks are done
211at reboot time.
212The root file system should be specified with a
213.Fa fs_passno
214of 1, and other file systems should have a
215.Fa fs_passno
216of 2.
217File systems within a drive will be checked sequentially,
218but file systems on different drives will be checked at the
219same time to utilize parallelism available in the hardware.
220If the sixth field is not present or is zero,
221a value of zero is returned and
222.Xr fsck 8
223will assume that the file system does not need to be checked.
224.Bd -literal
225#define	FSTAB_RW	"rw"	/* read/write device */
226#define	FSTAB_RQ	"rq"	/* read/write with quotas */
227#define	FSTAB_RO	"ro"	/* read-only device */
228#define	FSTAB_SW	"sw"	/* swap device */
229#define	FSTAB_XX	"xx"	/* ignore totally */
230
231struct fstab {
232	char	*fs_spec;	/* block special device name */
233	char	*fs_file;	/* file system path prefix */
234	char	*fs_vfstype;	/* File system type, ufs, nfs */
235	char	*fs_mntops;	/* Mount options ala -o */
236	char	*fs_type;	/* FSTAB_* from fs_mntops */
237	int	fs_freq;	/* dump frequency, in days */
238	int	fs_passno;	/* pass number on parallel fsck */
239};
240.Ed
241.Pp
242The proper way to read records from
243.Nm
244is to use the routines
245.Xr getfsent 3 ,
246.Xr getfsspec 3 ,
247.Xr getfstype 3 ,
248and
249.Xr getfsfile 3 .
250.Sh FILES
251.Bl -tag -width /etc/fstab -compact
252.It Pa /etc/fstab
253The file
254.Nm
255resides in
256.Pa /etc .
257.El
258.Sh SEE ALSO
259.Xr getfsent 3 ,
260.Xr getvfsbyname 3 ,
261.Xr HAMMER 5 ,
262.Xr dump 8 ,
263.Xr fsck 8 ,
264.Xr mount 8 ,
265.Xr quotacheck 8 ,
266.Xr quotaon 8 ,
267.Xr swapon 8 ,
268.Xr umount 8
269.Sh HISTORY
270The
271.Nm
272file format appeared in
273.Bx 4.0 .
274