xref: /dragonfly/share/man/man5/fstab.5 (revision 6ca88057)
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. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
29.\" $FreeBSD: src/share/man/man5/fstab.5,v 1.11.2.8 2003/02/10 12:21:08 des Exp $
30.\" $DragonFly: src/share/man/man5/fstab.5,v 1.5 2008/07/27 21:16:00 thomas Exp $
31.\"
32.Dd September 13, 2009
33.Dt FSTAB 5
34.Os
35.Sh NAME
36.Nm fstab
37.Nd static information about the file systems
38.Sh SYNOPSIS
39.In fstab.h
40.Sh DESCRIPTION
41The file
42.Nm
43contains descriptive information about the various file
44systems.
45.Nm
46is only read by programs, and not written;
47it is the duty of the system administrator to properly create
48and maintain this file.
49Each file system is described on a separate line;
50fields on each line are separated by tabs or spaces.
51The order of records in
52.Nm
53is important because
54.Xr fsck 8 ,
55.Xr mount 8 ,
56and
57.Xr umount 8
58sequentially iterate through
59.Nm
60doing their thing.
61.Pp
62The first field,
63.Pq Fa fs_spec ,
64describes the special file or
65remote file system to be mounted.
66This may be a
67.Pa /dev/<path> ,
68a label from a
69.Xr devtab 5
70(typically
71.Pa /etc/devtab ) ,
72or a
73.Pa <host>:<path>
74for NFS.
75Note that
76.Xr devtab 5
77labels maybe augmented with a
78.Pa .suffix
79trailer.
80For example
81.Pa mydisk.s1a .
82Also note
83.Pa /dev
84based paths can mount serial numbers similar to
85.Xr devtab 5
86labels by using the path
87.Pa /dev/serno/SERIALNO[.suffix] .
88.Pp
89The second field,
90.Pq Fa fs_file ,
91describes the mount point for the file system.
92For swap partitions, this field should be specified as
93.Dq none .
94.Pp
95The third field,
96.Pq Fa fs_vfstype ,
97describes the type of the file system.
98The system can support various file system types.
99Only the root,
100.Pa /usr ,
101and
102.Pa /tmp
103file systems need be statically
104compiled into the kernel;
105everything else will be automatically loaded at mount
106time.
107(Exception: the UFS family - FFS, MFS, and LFS cannot
108currently be demand-loaded.)  Some people still prefer to statically
109compile other file systems as well.
110.Pp
111The most common file system types are:
112.Bl -tag -width indent -offset indent
113.It Em HAMMER
114a local
115.Xr HAMMER 5
116file system
117.It Em ufs
118a local
119.Xr ffs 5
120.Ux
121file system
122.It Em mfs
123a local memory-based
124.Ux
125file system
126.It Em nfs
127a Sun Microsystems compatible
128.Dq "Network File System"
129.It Em swap
130a disk partition to be used for swapping
131.It Em msdos
132a local
133.Xr msdos 5
134DOS compatible file system
135.It Em cd9660
136a local CD-ROM file system (as per ISO 9660)
137.\" maybe also say Rock Ridge extensions are handled ?
138.It Em procfs
139a file system for accessing process data
140.El
141.Pp
142The fourth field,
143.Pq Fa fs_mntops ,
144describes the mount options associated with the file system.
145It is formatted as a comma separated list of options.
146It contains at least the type of mount (see
147.Fa fs_type
148below) plus any additional options
149appropriate to the file system type.
150See the options flag
151.Pq Fl o
152in the
153.Xr mount 8
154page and the file system specific page, such as
155.Xr mount_nfs 8 ,
156for additional options that may be specified.
157.Pp
158If the options ``userquota'' and/or ``groupquota'' are specified,
159the file system is automatically processed by the
160.Xr quotacheck 8
161command, and user and/or group disk quotas are enabled with
162.Xr quotaon 8 .
163By default,
164file system quotas are maintained in files named
165.Pa quota.user
166and
167.Pa quota.group
168which are located at the root of the associated file system.
169These defaults may be overridden by putting an equal sign
170and an alternative absolute pathname following the quota option.
171Thus, if the user quota file for
172.Pa /tmp
173is stored in
174.Pa /var/quotas/tmp.user ,
175this location can be specified as:
176.Bd -literal -offset indent
177userquota=/var/quotas/tmp.user
178.Ed
179.Pp
180If the option ``noauto'' is specified, the file system will not be automatically
181mounted at system startup.
182This is recommended for all remote file systems other than NFS,
183since only NFS mounts are delayed until after network initialization
184by the
185.Xr rc 8
186startup scripts.
187.Pp
188The type of the mount is extracted from the
189.Fa fs_mntops
190field and stored separately in the
191.Fa fs_type
192field (it is not deleted from the
193.Fa fs_mntops
194field).
195If
196.Fa fs_type
197is ``rw'' or ``ro'' then the file system whose name is given in the
198.Fa fs_file
199field is normally mounted read-write or read-only on the
200specified special file.
201If
202.Fa fs_type
203is ``sw'' then the special file is made available as a piece of swap
204space by the
205.Xr swapon 8
206command at the end of the system reboot procedure.
207The fields other than
208.Fa fs_spec
209and
210.Fa fs_type
211are unused.
212If
213.Fa fs_type
214is specified as ``xx'' the entry is ignored.
215This is useful to show disk partitions which are currently unused.
216.Pp
217The fifth field,
218.Pq Fa fs_freq ,
219is used for these file systems by the
220.Xr dump 8
221command to determine which file systems need to be dumped.
222If the fifth field is not present, a value of zero is returned and
223.Nm dump
224will assume that the file system does not need to be dumped.
225.Pp
226The sixth field,
227.Pq Fa fs_passno ,
228is used by the
229.Xr fsck 8
230program to determine the order in which file system checks are done
231at reboot time.
232The root file system should be specified with a
233.Fa fs_passno
234of 1, and other file systems should have a
235.Fa fs_passno
236of 2.
237File systems within a drive will be checked sequentially,
238but file systems on different drives will be checked at the
239same time to utilize parallelism available in the hardware.
240If the sixth field is not present or is zero,
241a value of zero is returned and
242.Xr fsck 8
243will assume that the file system does not need to be checked.
244.Bd -literal
245#define	FSTAB_RW	"rw"	/* read/write device */
246#define	FSTAB_RQ	"rq"	/* read/write with quotas */
247#define	FSTAB_RO	"ro"	/* read-only device */
248#define	FSTAB_SW	"sw"	/* swap device */
249#define	FSTAB_XX	"xx"	/* ignore totally */
250
251struct fstab {
252	char	*fs_spec;	/* block special device name */
253	char	*fs_file;	/* file system path prefix */
254	char	*fs_vfstype;	/* File system type, ufs, nfs */
255	char	*fs_mntops;	/* Mount options ala -o */
256	char	*fs_type;	/* FSTAB_* from fs_mntops */
257	int	fs_freq;	/* dump frequency, in days */
258	int	fs_passno;	/* pass number on parallel fsck */
259};
260.Ed
261.Pp
262The proper way to read records from
263.Nm
264is to use the routines
265.Xr getfsent 3 ,
266.Xr getfsspec 3 ,
267.Xr getfstype 3 ,
268and
269.Xr getfsfile 3 .
270.Sh FILES
271.Bl -tag -width /etc/fstab -compact
272.It Pa /etc/fstab
273The file
274.Nm
275resides in
276.Pa /etc .
277.El
278.Sh SEE ALSO
279.Xr getfsent 3 ,
280.Xr getvfsbyname 3 ,
281.Xr HAMMER 5 ,
282.Xr dump 8 ,
283.Xr fsck 8 ,
284.Xr mount 8 ,
285.Xr quotacheck 8 ,
286.Xr quotaon 8 ,
287.Xr swapon 8 ,
288.Xr umount 8
289.Sh HISTORY
290The
291.Nm
292file format appeared in
293.Bx 4.0 .
294