xref: /openbsd-src/share/man/man5/fstab.5 (revision 43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f)
1.\"	$OpenBSD: fstab.5,v 1.42 2009/06/08 17:03:15 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: June 8 2009 $
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.
72For filesystems of type ffs
73.Pq Xr mount_ffs 8 ,
74the special file name is the block special file name,
75and not the character special file name.
76For filesystems of type mfs
77.Pq Xr mount_mfs 8 ,
78the special file name is typically that of the primary swap area;
79if the keyword
80.Dq swap
81is used instead of a special file name,
82default configuration parameters are used.
83If a program needs the character special file name,
84the program must create it by appending an
85.Dq r
86after the last
87.Dq /
88in the special file name.
89.Pp
90The second field,
91.Fa fs_file ,
92describes the mount point for the filesystem.
93For swap partitions, this field should be specified as
94.Dq none .
95.Pp
96The third field,
97.Fa fs_vfstype ,
98describes the type of the filesystem.
99The system currently supports the following types of filesystems:
100.Pp
101.Bl -tag -width indent -offset indent -compact
102.It cd9660
103An ISO 9660 CD-ROM filesystem.
104.It ext2fs
105A local Linux compatible ext2fs
106filesystem.
107.It ffs
108A local
109.Ux
110filesystem.
111.It mfs
112A local memory-based
113.Ux
114filesystem.
115.It msdos
116An
117.Tn MS-DOS
118FAT filesystem.
119.It nfs
120A Sun Microsystems compatible Network File System.
121.It ntfs
122An NTFS filesystem.
123.It procfs
124A local filesystem containing process information.
125.It swap
126A disk partition to be used for swapping.
127.It udf
128A UDF filesystem.
129.It vnd
130A VND image file.
131.El
132.Pp
133The fourth field,
134.Fa fs_mntops ,
135describes the mount options associated with the filesystem.
136It is formatted as a comma separated list of options.
137It contains at least the type of mount (see
138.Fa fs_type
139below) plus any additional options appropriate to the filesystem type.
140.Pp
141The option
142.Dq auto
143can be used in the
144.Dq noauto
145form to cause
146a file system not to be mounted automatically (with
147.Ic mount -A
148or
149.Ic mount -a ,
150or at system boot time).
151.Pp
152If the options
153.Dq userquota
154and/or
155.Dq groupquota
156are specified, the filesystem is automatically processed by the
157.Xr quotacheck 8
158command, and user and/or group disk quotas are enabled with
159.Xr quotaon 8 .
160By default, filesystem quotas are maintained in files named
161.Pa quota.user
162and
163.Pa quota.group
164which are located at the root of the associated filesystem.
165These defaults may be overridden by putting an equal sign
166and an alternative absolute pathname following the quota option.
167Thus, if the user quota file for
168.Pa /tmp
169is stored in
170.Pa /var/quotas/tmp.user ,
171this location can be specified as:
172.Bd -literal -offset indent
173userquota=/var/quotas/tmp.user
174.Ed
175.Pp
176The type of the mount is extracted from the first parameter of the
177.Fa fs_mntops
178field and stored separately in the
179.Fa fs_type
180field (it is not deleted from the
181.Fa fs_mntops
182field).
183If
184.Fa fs_type
185is
186.Dq rw
187or
188.Dq ro
189then the filesystem whose name is given in the
190.Fa fs_file
191field is normally mounted read-write or read-only on the
192specified special file.
193If
194.Fa fs_type
195is
196.Dq sw
197then the special file is made available as a piece of swap space by the
198.Xr swapon 8
199command at the end of the system reboot procedure.
200The fields other than
201.Fa fs_spec
202and
203.Fa fs_type
204are unused.
205If
206.Fa fs_type
207is specified as
208.Dq xx
209the entry is ignored.
210This is useful to show disk partitions which are currently unused.
211.Pp
212The fifth field,
213.Fa fs_freq ,
214is used by the
215.Fl W
216and
217.Fl w
218options of
219.Xr dump 8
220to recommend which filesystems should be backed up.
221The value specifies the number of days
222after which a dump is regarded as being old;
223if it is not present, a value of zero is returned and
224.Xr dump 8
225will assume that the filesystem does not need to be dumped.
226.Pp
227The sixth field,
228.Fa fs_passno ,
229is used by the
230.Xr fsck 8
231program to determine the order in which filesystem checks are done
232at reboot time.
233The root filesystem should be specified with a
234.Fa fs_passno
235of 1, and other filesystems should have a
236.Fa fs_passno
237of 2.
238Filesystems within a drive will be checked sequentially,
239but filesystems on different drives will be checked at the
240same time to utilize parallelism available in the hardware.
241If the sixth field is not present or is zero,
242a value of zero is returned and
243.Xr fsck 8
244will assume that the filesystem does not need to be checked.
245.Bd -literal
246#define	FSTAB_RW	"rw"	/* read-write device */
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;	/* filesystem path prefix */
254	char	*fs_vfstype;	/* type of filesystem */
255	char	*fs_mntops;	/* comma separated mount options */
256	char	*fs_type;	/* rw, ro, sw, or xx */
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.Pa fstab
264is to use the routines
265.Xr getfsent 3 ,
266.Xr getfsspec 3 ,
267and
268.Xr getfsfile 3 .
269.Sh FILES
270.Bl -tag -width /etc/fstab -compact
271.It Pa /etc/fstab
272.El
273.Sh EXAMPLES
274Here is a sample
275.Pa /etc/fstab
276file:
277.Bd -literal -offset indent
278/dev/sd0a / ffs rw 1 1
279/dev/sd0e /var ffs rw,nodev,nosuid 1 2
280#/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2
281swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
282/dev/sd0g /usr ffs rw,nodev 1 2
283/dev/sd0h /usr/local ffs rw,nodev 1 2
284/dev/sd0i /home ffs rw,nodev,nosuid 1 2
285/dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2
286/dev/sd1b none swap sw 0 0
287/dev/cd0a /cdrom cd9660 ro,noauto 0 0
288server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0
289.Ed
290.Sh SEE ALSO
291.Xr quota 1 ,
292.Xr getfsent 3 ,
293.Xr fsck 8 ,
294.Xr mount 8 ,
295.Xr quotacheck 8 ,
296.Xr quotaon 8
297.Sh HISTORY
298The
299.Nm
300file format appeared in
301.Bx 4.0 .
302