xref: /openbsd-src/share/man/man5/fstab.5 (revision 50b7afb2c2c0993b0894d4e34bf857cb13ed9c80)
1.\"	$OpenBSD: fstab.5,v 1.51 2014/07/13 17:39:57 jmc Exp $
2.\"	$NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $
3.\"
4.\" Copyright (c) 1980, 1989, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
32.\"
33.Dd $Mdocdate: July 13 2014 $
34.Dt FSTAB 5
35.Os
36.Sh NAME
37.Nm fstab
38.Nd static information about the filesystems
39.Sh SYNOPSIS
40.Fd #include <fstab.h>
41.Sh DESCRIPTION
42The
43.Nm
44file contains descriptive information about the various file systems.
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 filesystem is described on a separate line;
50fields on each line are separated by tabs or spaces.
51Lines beginning with the
52.Sq #
53character are comments and are ignored.
54The order of records in
55.Nm
56is important because
57.Xr fsck 8
58and
59.Xr mount 8
60sequentially iterate through
61.Nm
62doing their thing.
63.Pp
64A line has the following format:
65.Bd -literal -offset indent
66fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
67.Ed
68.Pp
69The first field,
70.Fa fs_spec ,
71describes the block special device or remote filesystem to be mounted.
72A block special device may be specified by pathname
73or by
74.Xr disklabel 8
75UID (DUID).
76For filesystems of type MFS
77the special file name is typically that of the primary swap area;
78if the keyword
79.Dq swap
80is used instead of a special file name,
81default configuration parameters are used.
82If a program needs the character special file name,
83the program must create it by appending an
84.Sq r
85after the last
86.Sq /
87in the special file name.
88.Pp
89The second field,
90.Fa fs_file ,
91describes the mount point for the filesystem.
92For swap partitions, this field should be specified as
93.Dq none .
94.Pp
95The third field,
96.Fa fs_vfstype ,
97describes the type of the filesystem.
98The system currently supports the following types of filesystems:
99.Pp
100.Bl -tag -width indent -offset indent -compact
101.It cd9660
102An ISO 9660 CD-ROM filesystem.
103.It ext2fs
104A local Linux compatible ext2fs
105filesystem.
106.It ffs
107A local
108.Ux
109filesystem.
110.It mfs
111A local memory-based
112.Ux
113filesystem.
114.It msdos
115An
116.Tn MS-DOS
117FAT filesystem.
118.It nfs
119A Sun Microsystems compatible Network File System.
120.It ntfs
121An NTFS filesystem.
122.It procfs
123A local filesystem containing process information.
124.It swap
125A disk partition to be used for swapping.
126.It tmpfs
127A local memory-based
128.Ux
129filesystem.
130.It udf
131A UDF filesystem.
132.It vnd
133A VND image file.
134.El
135.Pp
136The fourth field,
137.Fa fs_mntops ,
138describes the mount options associated with the filesystem.
139It is formatted as a comma separated list of options.
140It contains at least the type of mount (see
141.Fa fs_type
142below) plus any additional options appropriate to the filesystem type.
143.Pp
144The option
145.Dq auto
146can be used in the
147.Dq noauto
148form to cause
149a file system not to be mounted automatically (with
150.Ic mount -A
151or
152.Ic mount -a ,
153or at system boot time).
154Similarly, the option
155.Dq net
156can be used to cause a file system to be considered only if the
157.Fl N
158flag is passed to
159.Xr mount 8
160or
161.Xr fsck 8 .
162.Pp
163If the options
164.Dq userquota
165and/or
166.Dq groupquota
167are specified, the filesystem is automatically processed by the
168.Xr quotacheck 8
169command, and user and/or group disk quotas are enabled with
170.Xr quotaon 8 .
171By default, filesystem quotas are maintained in files named
172.Pa quota.user
173and
174.Pa quota.group
175which are located at the root of the associated filesystem.
176These defaults may be overridden by putting an equal sign
177and an alternative absolute pathname following the quota option.
178Thus, if the user quota file for
179.Pa /tmp
180is stored in
181.Pa /var/quotas/tmp.user ,
182this location can be specified as:
183.Bd -literal -offset indent
184userquota=/var/quotas/tmp.user
185.Ed
186.Pp
187The type of the mount is extracted from the first parameter of the
188.Fa fs_mntops
189field and stored separately in the
190.Fa fs_type
191field (it is not deleted from the
192.Fa fs_mntops
193field).
194If
195.Fa fs_type
196is
197.Dq rw ,
198.Dq rq ,
199or
200.Dq ro
201then the filesystem 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
208.Dq sw
209then the special file is made available as a piece of swap space by the
210.Xr swapon 8
211command at the end of the system reboot procedure.
212The fields other than
213.Fa fs_spec
214and
215.Fa fs_type
216are unused.
217If
218.Fa fs_type
219is specified as
220.Dq xx
221the entry is ignored.
222This is useful to show disk partitions which are currently unused.
223.Pp
224The fifth field,
225.Fa fs_freq ,
226is used by the
227.Fl W
228and
229.Fl w
230options of
231.Xr dump 8
232to recommend which filesystems should be backed up.
233The value specifies the number of days
234after which a dump is regarded as being old;
235if it is not present, a value of zero is returned and
236.Xr dump 8
237will assume that the filesystem does not need to be dumped.
238.Pp
239The sixth field,
240.Fa fs_passno ,
241is used by the
242.Xr fsck 8
243program to determine the order in which filesystem checks are done
244at reboot time.
245The root filesystem should be specified with a
246.Fa fs_passno
247of 1, and other filesystems should have a
248.Fa fs_passno
249of 2.
250Filesystems within a drive will be checked sequentially,
251but filesystems on different drives will be checked at the
252same time to utilize parallelism available in the hardware.
253If the sixth field is not present or is zero,
254a value of zero is returned and
255.Xr fsck 8
256will assume that the filesystem does not need to be checked.
257.Bd -literal
258#define	FSTAB_RW	"rw"	/* read/write device */
259#define	FSTAB_RQ	"rq"	/* read/write with quotas */
260#define	FSTAB_RO	"ro"	/* read-only device */
261#define	FSTAB_SW	"sw"	/* swap device */
262#define	FSTAB_XX	"xx"	/* ignore totally */
263
264struct fstab {
265	char	*fs_spec;	/* block special device name */
266	char	*fs_file;	/* filesystem path prefix */
267	char	*fs_vfstype;	/* type of filesystem */
268	char	*fs_mntops;	/* comma separated mount options */
269	char	*fs_type;	/* rw, rq, ro, sw, or xx */
270	int	fs_freq;	/* dump frequency, in days */
271	int	fs_passno;	/* pass number on parallel fsck */
272};
273.Ed
274.Pp
275The proper way to read records from
276.Pa fstab
277is to use the routines
278.Xr getfsent 3 ,
279.Xr getfsspec 3 ,
280and
281.Xr getfsfile 3 .
282.Sh FILES
283.Bl -tag -width /etc/fstab -compact
284.It Pa /etc/fstab
285.El
286.Sh EXAMPLES
287Here is a sample
288.Pa /etc/fstab
289file:
290.Bd -literal -offset indent
291/dev/sd0b none swap sw
292/dev/sd1b none swap sw
293/dev/sd0a / ffs rw 1 1
294/dev/sd0e /var ffs rw,nodev,nosuid 1 2
295#/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2
296swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
297/dev/sd0g /usr ffs rw,nodev 1 2
298/dev/sd0h /usr/local ffs rw,nodev 1 2
299/dev/sd0i /home ffs rw,nodev,nosuid 1 2
300/dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2
301/dev/cd0a /cdrom cd9660 ro,noauto 0 0
3025b27c2761a9b0b06.i /mnt/key msdos rw,noauto 0 0
303server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0
304.Ed
305.Sh SEE ALSO
306.Xr quota 1 ,
307.Xr getfsent 3 ,
308.Xr fsck 8 ,
309.Xr mount 8 ,
310.Xr quotacheck 8 ,
311.Xr quotaon 8
312.Sh HISTORY
313The
314.Nm
315file format appeared in
316.Bx 4.0 .
317