xref: /netbsd-src/share/man/man5/fstab.5 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: fstab.5,v 1.36 2009/01/11 22:03:56 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 January 11, 2009
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.
50Lines beginning
51with
52.Dq #
53are comments.
54The order of records in
55.Nm
56is important because
57.Xr fsck 8 ,
58.Xr mount 8 ,
59and
60.Xr umount 8
61sequentially iterate through
62.Nm
63doing their respective tasks.
64.Pp
65Each configuration line/record in
66.Nm
67has the format:
68.Dl fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
69.Pp
70The first field,
71.Pq Fa fs_spec ,
72describes the block special device or
73remote filesystem to be mounted.
74For filesystems of type
75.Em ffs ,
76the special file name is the block special file name,
77and not the character special file name.
78If a program needs the character special file name,
79the program must create it by appending a
80.Dq r
81after the
82last
83.Dq /
84in the special file name.
85.Pp
86The second field,
87.Pq Fa fs_file ,
88describes the mount point for the filesystem.
89For swap and dump partitions, this field should be specified as
90.Dq none .
91.Pp
92The third field,
93.Pq Fa fs_vfstype ,
94describes the type of the filesystem.
95The system currently supports these filesystems:
96.Bl -tag -width filecore -offset indent
97.It Em adosfs
98an
99.Tn AmigaDOS
100filesystem.
101.It Em cd9660
102an
103.Tn ISO
1049660 CD-ROM filesystem.
105.It Em ext2fs
106an implementation of the Linux
107.Dq Second Extended File-system .
108.It Em fdesc
109an implementation of
110.Pa /dev/fd .
111.It Em ffs
112a local
113.Ux
114filesystem.
115.It Em filecore
116a filesystem for
117.Tn RISC\ OS .
118.It Em kernfs
119various and sundry kernel statistics.
120.It Em lfs
121a log-structured file-system.
122.It Em mfs
123a local memory-based
124.Ux
125filesystem.
126.It Em msdos
127an
128.Tn MS-DOS
129.Dq FAT filesystem .
130.It Em nfs
131a Sun Microsystems compatible
132.Dq Network File System .
133.It Em ntfs
134a filesystem used by
135.Tn Windows NT .
136Still experimental.
137.It Em null
138a loop-back filesystem, allowing parts of the system to be viewed
139elsewhere.
140.It Em overlay
141a demonstration of layered filesystems.
142.It Em portal
143a general filesystem interface, currently supports TCP and FS mounts.
144.It Em procfs
145a local filesystem of process information.
146.It Em ptyfs
147a pseudo-terminal device file system.
148.It Em smbfs
149a shared resource from an SMB/CIFS file server.
150.It Em swap
151a disk partition to be used for swapping and paging.
152.It Em tmpfs
153an efficient memory file system.
154.It Em umap
155a user and group re-mapping filesystem.
156.It Em union
157a translucent filesystem.
158.El
159.Pp
160The fourth field,
161.Pq Fa fs_mntops ,
162describes the mount options associated with the filesystem.
163It is formatted as a comma separated list of options.
164It contains at least the type of mount (see
165.Fa fs_type
166below) plus any additional options
167appropriate to the filesystem type.
168.Pp
169The option
170.Dq auto
171can be used in the
172.Dq noauto
173form to cause
174a file system not to be mounted automatically (with
175.Dq mount -a
176,
177or system boot time).
178.Pp
179If the options
180.Dq userquota
181and/or
182.Dq groupquota
183are specified,
184the filesystem is automatically processed by the
185.Xr quotacheck 8
186command, and user and/or group disk quotas are enabled with
187.Xr quotaon 8 .
188By default,
189filesystem quotas are maintained in files named
190.Pa quota.user
191and
192.Pa quota.group
193which are located at the root of the associated filesystem.
194These defaults may be overridden by putting an equal sign
195and an alternative absolute pathname following the quota option.
196Thus, if the user quota file for
197.Pa /tmp
198is stored in
199.Pa /var/quotas/tmp.user ,
200this location can be specified as:
201.Bd -literal -offset indent
202userquota=/var/quotas/tmp.user
203.Ed
204.Pp
205The option
206.Dq rump
207is used to mount the file system using a
208.Xr rump 3
209userspace server instead of the kernel server.
210.Pp
211The type of the mount is extracted from the
212.Fa fs_mntops
213field and stored separately in the
214.Fa fs_type
215field (it is not deleted from the
216.Fa fs_mntops
217field).
218If
219.Fa fs_type
220is
221.Dq rw
222or
223.Dq ro
224then the filesystem whose name is given in the
225.Fa fs_file
226field is normally mounted read-write or read-only on the
227specified special file.
228If
229.Fa fs_type
230is
231.Dq sw
232or
233.Dq dp
234then the special file is made available as a piece of swap
235or dump
236space by the
237.Xr swapctl 8
238command towards the beginning of the system reboot procedure.
239See
240.Xr swapctl 8
241for more information on configuring swap and dump devices.
242The fields other than
243.Fa fs_spec
244and
245.Fa fs_type
246are unused.
247If
248.Fa fs_type
249is specified as
250.Dq xx
251the entry is ignored.
252This is useful to show disk partitions which are currently unused.
253.Pp
254The fifth field,
255.Pq Fa fs_freq ,
256is used for these filesystems by the
257.Xr dump 8
258command to determine which filesystems need to be dumped.
259If the fifth field is not present, a value of zero is returned and
260.Xr dump 8
261will assume that the filesystem does not need to be dumped.
262.Pp
263The sixth field,
264.Pq Fa fs_passno ,
265is used by the
266.Xr fsck 8
267program to determine the order in which filesystem checks are done
268at reboot time.
269The root filesystem should be specified with a
270.Fa fs_passno
271of 1, and other filesystems should have a
272.Fa fs_passno
273of 2.
274Filesystems within a drive will be checked sequentially,
275but filesystems on different drives will be checked at the
276same time to use parallelism available in the hardware.
277If the sixth field is not present or zero,
278a value of zero is returned and
279.Xr fsck 8
280will assume that the filesystem does not need to be checked.
281.Bd -literal
282#define	FSTAB_RW	"rw"	/* read-write device */
283#define	FSTAB_RQ	"rq"	/* read/write with quotas */
284#define	FSTAB_RO	"ro"	/* read-only device */
285#define	FSTAB_SW	"sw"	/* swap device */
286#define	FSTAB_DP	"dp"	/* dump device */
287#define	FSTAB_XX	"xx"	/* ignore totally */
288
289struct fstab {
290	char	*fs_spec;	/* block special device name */
291	char	*fs_file;	/* filesystem path prefix */
292	char	*fs_vfstype;	/* type of filesystem */
293	char	*fs_mntops;	/* comma separated mount options */
294	char	*fs_type;	/* rw, ro, sw, or xx */
295	int	fs_freq;	/* dump frequency, in days */
296	int	fs_passno;	/* pass number on parallel fsck */
297};
298.Ed
299.Pp
300The proper way to read records from
301.Pa fstab
302is to use the routines
303.Xr getfsent 3 ,
304.Xr getfsspec 3 ,
305and
306.Xr getfsfile 3 .
307.Sh FILES
308.Bl -tag -width /etc/fstab
309.It Pa /etc/fstab
310The location of
311.Nm
312configuration file.
313.It Pa /usr/share/examples/fstab/
314Some useful configuration examples.
315.El
316.Sh SEE ALSO
317.Xr getfsent 3 ,
318.Xr mount 8 ,
319.Xr swapctl 8
320.Sh HISTORY
321The
322.Nm
323file format appeared in
324.Bx 4.0 .
325