xref: /netbsd/share/man/man5/fstab.5 (revision bf9ec67e)
1.\"	$NetBSD: fstab.5,v 1.25 2002/05/04 19:50:36 jdolecek 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 \*[Lt]fstab.h\*[Gt]
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 filecore
118a filesystem for
119.Tn RISC\ OS
120.It Em kernfs
121various and sundry kernel statistics
122.It Em lfs
123a log-structured file-system.  Currently does not work.
124.It Em mfs
125a local memory-based
126.Ux
127filesystem
128.It Em msdos
129an
130.Tn MS-DOS
131.Dq FAT filesystem
132.It Em nfs
133a Sun Microsystems compatible
134.Dq Network File System
135.It Em ntfs
136a filesystem used by
137.Tn Windows NT .
138Still experimental.
139.It Em null
140a loop-back filesystem, allowing parts of the system to be viewed
141elsewhere.
142.It Em overlay
143a demonstration of layered filesystems.
144.It Em portal
145a general filesystem interface, currently supports TCP and FS mounts.
146.It Em procfs
147a local filesystem of process information
148.It Em swap
149a disk partition to be used for swapping and paging
150.It Em umap
151a user and group re-mapping filesystem.
152.It Em union
153a translucent filesystem
154.El
155.Pp
156The fourth field,
157.Pq Fa fs_mntops ,
158describes the mount options associated with the filesystem.
159It is formatted as a comma separated list of options.
160It contains at least the type of mount (see
161.Fa fs_type
162below) plus any additional options
163appropriate to the filesystem type.
164.Pp
165The option
166.Dq auto
167can be used in the
168.Dq noauto
169form to cause
170a file system not to be mounted automatically (with
171.Dq mount -a
172,
173or system boot time).
174.Pp
175If the options
176.Dq userquota
177and/or
178.Dq groupquota
179are specified,
180the filesystem is automatically processed by the
181.Xr quotacheck 8
182command, and user and/or group disk quotas are enabled with
183.Xr quotaon 8 .
184By default,
185filesystem quotas are maintained in files named
186.Pa quota.user
187and
188.Pa quota.group
189which are located at the root of the associated filesystem.
190These defaults may be overridden by putting an equal sign
191and an alternative absolute pathname following the quota option.
192Thus, if the user quota file for
193.Pa /tmp
194is stored in
195.Pa /var/quotas/tmp.user ,
196this location can be specified as:
197.Bd -literal -offset indent
198userquota=/var/quotas/tmp.user
199.Ed
200.Pp
201The type of the mount is extracted from the
202.Fa fs_mntops
203field and stored separately in the
204.Fa fs_type
205field (it is not deleted from the
206.Fa fs_mntops
207field).
208If
209.Fa fs_type
210is
211.Dq rw
212or
213.Dq ro
214then the filesystem whose name is given in the
215.Fa fs_file
216field is normally mounted read-write or read-only on the
217specified special file.
218If
219.Fa fs_type
220is
221.Dq sw
222or
223.Dq dp
224then the special file is made available as a piece of swap
225or dump
226space by the
227.Xr swapctl 8
228command towards the beginning of the system reboot procedure.
229See
230.Xr swapctl 8
231for more information on configuring swap and dump devices.
232The fields other than
233.Fa fs_spec
234and
235.Fa fs_type
236are unused.
237If
238.Fa fs_type
239is specified as
240.Dq xx
241the entry is ignored.
242This is useful to show disk partitions which are currently unused.
243.Pp
244The fifth field,
245.Pq Fa fs_freq ,
246is used for these filesystems by the
247.Xr dump 8
248command to determine which filesystems need to be dumped.
249If the fifth field is not present, a value of zero is returned and
250.Xr dump 8
251will assume that the filesystem does not need to be dumped.
252.Pp
253The sixth field,
254.Pq Fa fs_passno ,
255is used by the
256.Xr fsck 8
257program to determine the order in which filesystem checks are done
258at reboot time.
259The root filesystem should be specified with a
260.Fa fs_passno
261of 1, and other filesystems should have a
262.Fa fs_passno
263of 2.
264Filesystems within a drive will be checked sequentially,
265but filesystems on different drives will be checked at the
266same time to utilize parallelism available in the hardware.
267If the sixth field is not present or zero,
268a value of zero is returned and
269.Xr fsck 8
270will assume that the filesystem does not need to be checked.
271.Bd -literal
272#define	FSTAB_RW	"rw"	/* read-write device */
273#define	FSTAB_RO	"ro"	/* read-only device */
274#define	FSTAB_SW	"sw"	/* swap device */
275#define	FSTAB_DP	"dp"	/* dump device */
276#define	FSTAB_XX	"xx"	/* ignore totally */
277
278struct fstab {
279	char	*fs_spec;	/* block special device name */
280	char	*fs_file;	/* filesystem path prefix */
281	char	*fs_vfstype;	/* type of filesystem */
282	char	*fs_mntops;	/* comma separated mount options */
283	char	*fs_type;	/* rw, ro, sw, or xx */
284	int	fs_freq;	/* dump frequency, in days */
285	int	fs_passno;	/* pass number on parallel fsck */
286};
287.Ed
288.Pp
289The proper way to read records from
290.Pa fstab
291is to use the routines
292.Xr getfsent 3 ,
293.Xr getfsspec 3 ,
294.Xr getfstype 3 ,
295and
296.Xr getfsfile 3 .
297.Sh FILES
298.Bl -tag -width /etc/fstab
299.It Pa /etc/fstab
300The location of
301.Nm
302configuration file.
303.It Pa /usr/share/examples/fstab/
304Some useful configuration examples.
305.El
306.Sh SEE ALSO
307.Xr getfsent 3 ,
308.Xr mount 8 ,
309.Xr swapctl 8
310.Sh HISTORY
311The
312.Nm
313file format appeared in
314.Bx 4.0 .
315