xref: /netbsd-src/share/man/man5/fstab.5 (revision 5aefcfdc06931dd97e76246d2fe0302f7b3fe094)
1.\"	$NetBSD: fstab.5,v 1.21 2000/11/09 00:06:17 lukem Exp $
2.\"
3.\" Copyright (c) 1980, 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
35.\"
36.Dd November 9, 2000
37.Dt FSTAB 5
38.Os
39.Sh NAME
40.Nm fstab
41.Nd filesystem table for devices, types, and mount points
42.Sh SYNOPSIS
43.Fd #include <fstab.h>
44.Sh DESCRIPTION
45The file
46.Nm
47contains descriptive information about the various file systems.
48.Nm
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. Lines beginning
54with
55.Dq #
56are comments.
57The order of records in
58.Nm
59is important because
60.Xr fsck 8 ,
61.Xr mount 8 ,
62and
63.Xr umount 8
64sequentially iterate through
65.Nm
66doing their respective tasks.
67.Pp
68Each configuration line/record in
69.Nm
70has the format:
71.Dl fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
72.Pp
73The first field,
74.Pq Fa fs_spec ,
75describes the block special device or
76remote filesystem to be mounted.
77For filesystems of type
78.Em ffs ,
79the special file name is the block special file name,
80and not the character special file name.
81If a program needs the character special file name,
82the program must create it by appending a
83.Dq r
84after the
85last
86.Dq /
87in the special file name.
88.Pp
89The second field,
90.Pq Fa fs_file ,
91describes the mount point for the filesystem.
92For swap and dump partitions, this field should be specified as
93.Dq none .
94.Pp
95The third field,
96.Pq Fa fs_vfstype ,
97describes the type of the filesystem.
98The system currently supports these filesystems:
99.Bl -tag -width indent -offset indent
100.It Em adosfs
101an
102.Tn AmigaDOS
103filesystem
104.It Em cd9660
105an
106.Tn ISO
1079660 CD-ROM filesystem
108.It Em ext2fs
109an implementation of the Linux
110.Dq Second Extended File-system .
111.It Em fdesc
112an implementation of /dev/fd
113.It Em ffs
114a local
115.Ux
116filesystem
117.It Em kernfs
118various and sundry kernel statistics
119.It Em lfs
120a log-structured file-system.  Currently does not work.
121.It Em mfs
122a local memory-based
123.Ux
124filesystem
125.It Em msdos
126an
127.Tn MS-DOS
128.Dq FAT filesystem
129.It Em nfs
130a Sun Microsystems compatible
131.Dq Network File System
132.It Em null
133a loop-back filesystem, allowing parts of the system to be viewed
134elsewhere.
135.It Em portal
136a general filesystem interface, currently supports TCP and FS mounts.
137.It Em procfs
138a local filesystem of process information
139.It Em swap
140a disk partition to be used for swapping and paging
141.It Em umap
142a user and group re-mapping filesystem.
143.It Em union
144a translucent filesystem
145.El
146.Pp
147The fourth field,
148.Pq Fa fs_mntops ,
149describes the mount options associated with the filesystem.
150It is formatted as a comma separated list of options.
151It contains at least the type of mount (see
152.Fa fs_type
153below) plus any additional options
154appropriate to the filesystem type.
155.Pp
156The option
157.Dq auto
158can be used in the
159.Dq noauto
160form to cause
161a file system not to be mounted automatically (with
162.Dq mount -a
163,
164or system boot time).
165.Pp
166If the options
167.Dq userquota
168and/or
169.Dq groupquota
170are specified,
171the filesystem is automatically processed by the
172.Xr quotacheck 8
173command, and user and/or group disk quotas are enabled with
174.Xr quotaon 8 .
175By default,
176filesystem quotas are maintained in files named
177.Pa quota.user
178and
179.Pa quota.group
180which are located at the root of the associated filesystem.
181These defaults may be overridden by putting an equal sign
182and an alternative absolute pathname following the quota option.
183Thus, if the user quota file for
184.Pa /tmp
185is stored in
186.Pa /var/quotas/tmp.user ,
187this location can be specified as:
188.Bd -literal -offset indent
189userquota=/var/quotas/tmp.user
190.Ed
191.Pp
192The type of the mount is extracted from the
193.Fa fs_mntops
194field and stored separately in the
195.Fa fs_type
196field (it is not deleted from the
197.Fa fs_mntops
198field).
199If
200.Fa fs_type
201is
202.Dq rw
203or
204.Dq ro
205then the filesystem whose name is given in the
206.Fa fs_file
207field is normally mounted read-write or read-only on the
208specified special file.
209If
210.Fa fs_type
211is
212.Dq sw
213or
214.Dq dp
215then the special file is made available as a piece of swap
216or dump
217space by the
218.Xr swapctl 8
219command towards the beginning of the system reboot procedure.
220See
221.Xr swapctl 8
222for more information on configuring swap and dump devices.
223The fields other than
224.Fa fs_spec
225and
226.Fa fs_type
227are unused.
228If
229.Fa fs_type
230is specified as
231.Dq xx
232the entry is ignored.
233This is useful to show disk partitions which are currently unused.
234.Pp
235The fifth field,
236.Pq Fa fs_freq ,
237is used for these filesystems by the
238.Xr dump 8
239command to determine which filesystems need to be dumped.
240If the fifth field is not present, a value of zero is returned and
241.Xr dump 8
242will assume that the filesystem does not need to be dumped.
243.Pp
244The sixth field,
245.Pq Fa fs_passno ,
246is used by the
247.Xr fsck 8
248program to determine the order in which filesystem checks are done
249at reboot time.
250The root filesystem should be specified with a
251.Fa fs_passno
252of 1, and other filesystems should have a
253.Fa fs_passno
254of 2.
255Filesystems within a drive will be checked sequentially,
256but filesystems on different drives will be checked at the
257same time to utilize parallelism available in the hardware.
258If the sixth field is not present or zero,
259a value of zero is returned and
260.Xr fsck 8
261will assume that the filesystem does not need to be checked.
262.Bd -literal
263#define	FSTAB_RW	"rw"	/* read-write device */
264#define	FSTAB_RO	"ro"	/* read-only device */
265#define	FSTAB_SW	"sw"	/* swap device */
266#define	FSTAB_DP	"dp"	/* dump device */
267#define	FSTAB_XX	"xx"	/* ignore totally */
268
269struct fstab {
270	char	*fs_spec;	/* block special device name */
271	char	*fs_file;	/* filesystem path prefix */
272	char	*fs_vfstype;	/* type of filesystem */
273	char	*fs_mntops;	/* comma separated mount options */
274	char	*fs_type;	/* rw, ro, sw, or xx */
275	int	fs_freq;	/* dump frequency, in days */
276	int	fs_passno;	/* pass number on parallel fsck */
277};
278.Ed
279.Pp
280The proper way to read records from
281.Pa fstab
282is to use the routines
283.Xr getfsent 3 ,
284.Xr getfsspec 3 ,
285.Xr getfstype 3 ,
286and
287.Xr getfsfile 3 .
288.Sh FILES
289.Bl -tag -width /etc/fstab -compact
290.It Pa /etc/fstab
291The file
292.Nm
293resides in
294.Pa /etc .
295.El
296.Sh SEE ALSO
297.Xr getfsent 3 ,
298.Xr mount_ados 8 ,
299.Xr mount_cd9660 8 ,
300.Xr mount_ext2fs 8 ,
301.Xr mount_fdesc 8 ,
302.Xr mount_ffs 8 ,
303.Xr mount_kernfs 8 ,
304.Xr mount_lfs 8 ,
305.Xr mount_mfs 8 ,
306.Xr mount_msdos 8 ,
307.Xr mount_nfs 8 ,
308.Xr mount_null 8 ,
309.Xr mount_portal 8 ,
310.Xr mount_procfs 8 ,
311.Xr mount_ufs 8 ,
312.Xr mount_umap 8 ,
313.Xr mount_union 8 ,
314.Xr swapctl 8
315.Sh HISTORY
316The
317.Nm
318file format appeared in
319.Bx 4.0 .
320