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