xref: /dragonfly/share/man/man5/fstab.5 (revision 678e8cc6)
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 September 13, 2009
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.
70This may be a
71.Pa /dev/<path> ,
72a label from a
73.Xr devtab 5
74(typically
75.Pa /etc/devtab ) ,
76or a
77.Pa <host>:<path>
78for NFS.
79Note that
80.Xr devtab 5
81labels maybe augmented with a
82.Pa .suffix
83trailer.
84For example
85.Pa mydisk.s1a .
86Also note
87.Pa /dev
88based paths can mount serial numbers similar to
89.Xr devtab 5
90labels by using the path
91.Pa /dev/serno/SERIALNO[.suffix] .
92.Pp
93The second field,
94.Pq Fa fs_file ,
95describes the mount point for the file system.
96For swap partitions, this field should be specified as
97.Dq none .
98.Pp
99The third field,
100.Pq Fa fs_vfstype ,
101describes the type of the file system.
102The system can support various file system types.
103Only the root,
104.Pa /usr ,
105and
106.Pa /tmp
107file systems need be statically
108compiled into the kernel;
109everything else will be automatically loaded at mount
110time.
111(Exception: the UFS family - FFS, MFS, and LFS cannot
112currently be demand-loaded.)  Some people still prefer to statically
113compile other file systems as well.
114.Pp
115The most common file system types are:
116.Bl -tag -width indent -offset indent
117.It Em HAMMER
118a local
119.Xr HAMMER 5
120file system
121.It Em ufs
122a local
123.Xr ffs 5
124.Ux
125file system
126.It Em mfs
127a local memory-based
128.Ux
129file system
130.It Em nfs
131a Sun Microsystems compatible
132.Dq "Network File System"
133.It Em swap
134a disk partition to be used for swapping
135.It Em msdos
136a local
137.Xr msdos 5
138DOS compatible file system
139.It Em cd9660
140a local CD-ROM file system (as per ISO 9660)
141.\" maybe also say Rock Ridge extensions are handled ?
142.It Em procfs
143a file system for accessing process data
144.El
145.Pp
146The fourth field,
147.Pq Fa fs_mntops ,
148describes the mount options associated with the file system.
149It is formatted as a comma separated list of options.
150It contains at least the type of mount (see
151.Fa fs_type
152below) plus any additional options
153appropriate to the file system type.
154See the options flag
155.Pq Fl o
156in the
157.Xr mount 8
158page and the file system specific page, such as
159.Xr mount_nfs 8 ,
160for additional options that may be specified.
161.Pp
162If the options ``userquota'' and/or ``groupquota'' are specified,
163the file system is automatically processed by the
164.Xr quotacheck 8
165command, and user and/or group disk quotas are enabled with
166.Xr quotaon 8 .
167By default,
168file system quotas are maintained in files named
169.Pa quota.user
170and
171.Pa quota.group
172which are located at the root of the associated file system.
173These defaults may be overridden by putting an equal sign
174and an alternative absolute pathname following the quota option.
175Thus, if the user quota file for
176.Pa /tmp
177is stored in
178.Pa /var/quotas/tmp.user ,
179this location can be specified as:
180.Bd -literal -offset indent
181userquota=/var/quotas/tmp.user
182.Ed
183.Pp
184If the option ``noauto'' is specified, the file system will not be automatically
185mounted at system startup.
186This is recommended for all remote file systems other than NFS,
187since only NFS mounts are delayed until after network initialization
188by the
189.Xr rc 8
190startup scripts.
191.Pp
192The type of the mount is extracted from the
193.Fa fs_mntops
194field and stored separately in the
195.Fa fs_type
196field (it is not deleted from the
197.Fa fs_mntops
198field).
199If
200.Fa fs_type
201is ``rw'' or ``ro'' then the file system whose name is given in the
202.Fa fs_file
203field is normally mounted read-write or read-only on the
204specified special file.
205If
206.Fa fs_type
207is ``sw'' then the special file is made available as a piece of swap
208space by the
209.Xr swapon 8
210command at the end of the system reboot procedure.
211The fields other than
212.Fa fs_spec
213and
214.Fa fs_type
215are unused.
216If
217.Fa fs_type
218is specified as ``xx'' the entry is ignored.
219This is useful to show disk partitions which are currently unused.
220.Pp
221The fifth field,
222.Pq Fa fs_freq ,
223is used for these file systems by the
224.Xr dump 8
225command to determine which file systems need to be dumped.
226If the fifth field is not present, a value of zero is returned and
227.Nm dump
228will assume that the file system does not need to be dumped.
229.Pp
230The sixth field,
231.Pq Fa fs_passno ,
232is used by the
233.Xr fsck 8
234program to determine the order in which file system checks are done
235at reboot time.
236The root file system should be specified with a
237.Fa fs_passno
238of 1, and other file systems should have a
239.Fa fs_passno
240of 2.
241File systems within a drive will be checked sequentially,
242but file systems on different drives will be checked at the
243same time to utilize parallelism available in the hardware.
244If the sixth field is not present or is zero,
245a value of zero is returned and
246.Xr fsck 8
247will assume that the file system does not need to be checked.
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.Nm
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 HAMMER 5 ,
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