xref: /openbsd-src/share/man/man5/fstab.5 (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1.\"	$OpenBSD: fstab.5,v 1.41 2007/09/08 09:03:43 henning 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: September 8 2007 $
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 for these filesystems by the
215.Xr dump 8
216command to determine which filesystems need to be dumped.
217If the fifth field is not present, a value of zero is returned and
218.Xr dump 8
219will assume that the filesystem does not need to be dumped.
220.Pp
221The sixth field,
222.Fa fs_passno ,
223is used by the
224.Xr fsck 8
225program to determine the order in which filesystem checks are done
226at reboot time.
227The root filesystem should be specified with a
228.Fa fs_passno
229of 1, and other filesystems should have a
230.Fa fs_passno
231of 2.
232Filesystems within a drive will be checked sequentially,
233but filesystems on different drives will be checked at the
234same time to utilize parallelism available in the hardware.
235If the sixth field is not present or is zero,
236a value of zero is returned and
237.Xr fsck 8
238will assume that the filesystem does not need to be checked.
239.Bd -literal
240#define	FSTAB_RW	"rw"	/* read-write device */
241#define	FSTAB_RO	"ro"	/* read-only device */
242#define	FSTAB_SW	"sw"	/* swap device */
243#define	FSTAB_XX	"xx"	/* ignore totally */
244
245struct fstab {
246	char	*fs_spec;	/* block special device name */
247	char	*fs_file;	/* filesystem path prefix */
248	char	*fs_vfstype;	/* type of filesystem */
249	char	*fs_mntops;	/* comma separated mount options */
250	char	*fs_type;	/* rw, ro, sw, or xx */
251	int	fs_freq;	/* dump frequency, in days */
252	int	fs_passno;	/* pass number on parallel fsck */
253};
254.Ed
255.Pp
256The proper way to read records from
257.Pa fstab
258is to use the routines
259.Xr getfsent 3 ,
260.Xr getfsspec 3 ,
261and
262.Xr getfsfile 3 .
263.Sh FILES
264.Bl -tag -width /etc/fstab -compact
265.It Pa /etc/fstab
266.El
267.Sh EXAMPLES
268Here is a sample
269.Pa /etc/fstab
270file:
271.Bd -literal -offset indent
272/dev/sd0a / ffs rw 1 1
273/dev/sd0e /var ffs rw,nodev,nosuid 1 2
274#/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2
275swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
276/dev/sd0g /usr ffs rw,nodev 1 2
277/dev/sd0h /usr/local ffs rw,nodev 1 2
278/dev/sd0i /home ffs rw,nodev,nosuid 1 2
279/dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2
280/dev/sd1b none swap sw 0 0
281/dev/cd0a /cdrom cd9660 ro,noauto 0 0
282server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0
283.Ed
284.Sh SEE ALSO
285.Xr quota 1 ,
286.Xr getfsent 3 ,
287.Xr fsck 8 ,
288.Xr mount 8 ,
289.Xr quotacheck 8 ,
290.Xr quotaon 8
291.Sh HISTORY
292The
293.Nm
294file format appeared in
295.Bx 4.0 .
296