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