xref: /netbsd-src/share/man/man5/fstab.5 (revision d9158b13b5dfe46201430699a3f7a235ecf28df3)
1.\" Copyright (c) 1980, 1989, 1991 The Regents of the University of California.
2.\" 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.\"     from: @(#)fstab.5	6.5 (Berkeley) 5/10/91
33.\"	$Id: fstab.5,v 1.3 1993/11/28 08:48:42 mycroft Exp $
34.\"
35.Dd May 10, 1991
36.Dt FSTAB 5
37.Os BSD 4
38.Sh NAME
39.Nm fstab
40.Nd static information about the filesystems
41.Sh SYNOPSIS
42.Fd #include <fstab.h>
43.Sh DESCRIPTION
44The file
45.Nm fstab
46contains descriptive information about the various file
47systems.
48.Nm fstab
49is only read by programs, and not written;
50it is the duty of the system administrator to properly create
51and maintain this file.
52Each filesystem is described on a separate line;
53fields on each line are separated by tabs or spaces.
54The order of records in
55.Nm fstab
56is important because
57.Xr fsck 8 ,
58.Xr mount 8 ,
59and
60.Xr umount 8
61sequentially iterate through
62.Nm fstab
63doing their thing.
64.Pp
65The first field,
66.Pq Fa fs_spec ,
67describes the block special device or
68remote filesystem to be mounted.
69For filesystems of type
70.Em ufs ,
71the special file name is the block special file name,
72and not the character special file name.
73If a program needs the character special file name,
74the program must create it by appending a ``r'' after the
75last ``/'' in the special file name.
76.Pp
77The second field,
78.Pq Fa fs_file ,
79describes the mount point for the filesystem.
80For swap partitions, this field should be specified as ``none''.
81.Pp
82The third field,
83.Pq Fa fs_vfstype ,
84describes the type of the filesystem.
85The system currently supports nine types of filesystems:
86.Bl -tag -width indent -offset indent
87.It Em fdesc
88an implementation of /dev/fd
89.It Em isofs
90an ISO 9660 CD-ROM filesystem
91.It Em kernfs
92various and sundry kernel statistics
93.It Em mfs
94a local memory-based
95.Tn UNIX
96filesystem
97.It Em msdos
98a MSDOS ``FAT'' filesystem
99.It Em nfs
100a Sun Microsystems compatible ``Network File System''
101.It Em procfs
102a local filesystem of process information
103.It Em swap
104a disk partition to be used for swapping
105.It Em ufs
106a local
107.Tn UNIX
108filesystem
109.El
110.Pp
111The fourth field,
112.Pq Fa fs_mntops ,
113describes the mount options associated with the filesystem.
114It is formatted as a comma separated list of options.
115It contains at least the type of mount (see
116.Fa fs_type
117below) plus any additional options
118appropriate to the filesystem type.
119.Pp
120If the options ``userquota'' and/or ``groupquota'' are specified,
121the filesystem is automatically processed by the
122.Xr quotacheck 8
123command, and user and/or group disk quotas are enabled with
124.Xr quotaon 8 .
125By default,
126filesystem quotas are maintained in files named
127.Pa quota.user
128and
129.Pa quota.group
130which are located at the root of the associated filesystem.
131These defaults may be overridden by putting an equal sign
132and an alternative absolute pathname following the quota option.
133Thus, if the user quota file for
134.Pa /tmp
135is stored in
136.Pa /var/quotas/tmp.user ,
137this location can be specified as:
138.Bd -literal -offset indent
139userquota=/var/quotas/tmp.user
140.Ed
141.Pp
142The type of the mount is extracted from the
143.Fa fs_mntops
144field and stored separately in the
145.Fa fs_type
146field (it is not deleted from the
147.Fa fs_mntops
148field).
149If
150.Fa fs_type
151is ``rw'' or ``ro'' then the filesystem whose name is given in the
152.Fa fs_file
153field is normally mounted read-write or read-only on the
154specified special file.
155If
156.Fa fs_type
157is ``sw'' then the special file is made available as a piece of swap
158space by the
159.Xr swapon 8
160command at the end of the system reboot procedure.
161The fields other than
162.Fa fs_spec
163and
164.Fa fs_type
165are unused.
166If
167.Fa fs_type
168is specified as ``xx'' the entry is ignored.
169This is useful to show disk partitions which are currently unused.
170.Pp
171The fifth field,
172.Pq Fa fs_freq ,
173is used for these filesystems by the
174.Xr dump 8
175command to determine which filesystems need to be dumped.
176If the fifth field is not present, a value of zero is returned and
177.Xr dump
178will assume that the filesystem does not need to be dumped.
179.Pp
180The sixth field,
181.Pq Fa fs_passno ,
182is used by the
183.Xr fsck 8
184program to determine the order in which filesystem checks are done
185at reboot time.
186The root filesystem should be specified with a
187.Fa fs_passno
188of 1, and other filesystems should have a
189.Fa fs_passno
190of 2.
191Filesystems within a drive will be checked sequentially,
192but filesystems on different drives will be checked at the
193same time to utilize parallelism available in the hardware.
194If the sixth field is not present or zero,
195a value of zero is returned and
196.Xr fsck
197will assume that the filesystem does not need to be checked.
198.Bd -literal
199#define	FSTAB_RW	"rw"	/* read-write device */
200#define	FSTAB_RO	"ro"	/* read-only device */
201#define	FSTAB_SW	"sw"	/* swap device */
202#define	FSTAB_XX	"xx"	/* ignore totally */
203
204struct fstab {
205	char	*fs_spec;	/* block special device name */
206	char	*fs_file;	/* filesystem path prefix */
207	char	*fs_vfstype;	/* type of filesystem */
208	char	*fs_mntops;	/* comma separated mount options */
209	char	*fs_type;	/* rw, ro, sw, or xx */
210	int	fs_freq;	/* dump frequency, in days */
211	int	fs_passno;	/* pass number on parallel dump */
212};
213.Ed
214.Pp
215The proper way to read records from
216.Pa fstab
217is to use the routines
218.Xr getfsent 3 ,
219.Xr getfsspec 3 ,
220.Xr getfstype 3 ,
221and
222.Xr getfsfile 3 .
223.Sh FILES
224.Bl -tag -width /etc/fstab -compact
225.It Pa /etc/fstab
226The file
227.Nm fstab
228resides in
229.Pa /etc .
230.El
231.Sh SEE ALSO
232.Xr getfsent 3
233.Sh HISTORY
234The
235.Nm
236file format appeared in
237.Bx 4.0 .
238