xref: /netbsd-src/share/man/man5/fstab.5 (revision 1b9578b8c2c1f848eeb16dabbfd7d1f0d9fdefbd)
1.\"	$NetBSD: fstab.5,v 1.38 2011/03/06 17:22:50 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 6, 2011
33.Dt FSTAB 5
34.Os
35.Sh NAME
36.Nm fstab
37.Nd file system 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 file system 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 file system to be mounted.
74For file systems 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 file system.
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 file system.
95The system currently supports these file systems:
96.Bl -tag -width filecore -offset indent
97.It Em adosfs
98an
99.Tn AmigaDOS
100file system.
101.It Em cd9660
102an
103.Tn ISO
1049660 CD-ROM file system.
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
114file system.
115.It Em filecore
116a file system 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
125file system.
126.It Em msdos
127an
128.Tn MS-DOS
129.Dq FAT file system .
130.It Em nfs
131a Sun Microsystems compatible
132.Dq Network File System .
133.It Em ntfs
134a file system used by
135.Tn Windows NT .
136Still experimental.
137.It Em null
138a loop-back file system, allowing parts of the system to be viewed
139elsewhere.
140.It Em overlay
141a demonstration of layered file systems.
142.It Em portal
143a general file system interface, currently supports TCP and FS mounts.
144.It Em procfs
145a local file system 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 file system.
156.It Em union
157a translucent file system.
158.El
159.Pp
160The fourth field,
161.Pq Fa fs_mntops ,
162describes the mount options associated with the file system.
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 file system 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 file system is automatically processed by the
185.Xr quotacheck 8
186command, and legacy user and/or group disk quotas are enabled with
187.Xr quotaon 8 .
188By default,
189file system quotas are maintained in files named
190.Pa quota.user
191and
192.Pa quota.group
193which are located at the root of the associated file system.
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
205It is recommended to turn on the new, in-file system quota with
206.Xr tunefs 8
207or at
208.Xr newfs 8
209time, and to not use the
210.Dq userquota
211or
212.Dq groupquota
213options.
214Migration of limits to the new in-file system quota can be handled
215by
216.Xr repquota 8
217with option
218.Fl x
219and
220.Xr quotactl 8 .
221.Pp
222The option
223.Dq rump
224is used to mount the file system using a
225.Xr rump 3
226userspace server instead of the kernel server.
227.Pp
228The type of the mount is extracted from the
229.Fa fs_mntops
230field and stored separately in the
231.Fa fs_type
232field (it is not deleted from the
233.Fa fs_mntops
234field).
235If
236.Fa fs_type
237is
238.Dq rw
239or
240.Dq ro
241then the file system whose name is given in the
242.Fa fs_file
243field is normally mounted read-write or read-only on the
244specified special file.
245If
246.Fa fs_type
247is
248.Dq sw
249or
250.Dq dp
251then the special file is made available as a piece of swap
252or dump
253space by the
254.Xr swapctl 8
255command towards the beginning of the system reboot procedure.
256See
257.Xr swapctl 8
258for more information on configuring swap and dump devices.
259The fields other than
260.Fa fs_spec
261and
262.Fa fs_type
263are unused.
264If
265.Fa fs_type
266is specified as
267.Dq xx
268the entry is ignored.
269This is useful to show disk partitions which are currently unused.
270.Pp
271The fifth field,
272.Pq Fa fs_freq ,
273is used for these file systems by the
274.Xr dump 8
275command to determine which file systems need to be dumped.
276If the fifth field is not present, a value of zero is returned and
277.Xr dump 8
278will assume that the file system does not need to be dumped.
279.Pp
280The sixth field,
281.Pq Fa fs_passno ,
282is used by the
283.Xr fsck 8
284program to determine the order in which file system checks are done
285at reboot time.
286The root file system should be specified with a
287.Fa fs_passno
288of 1, and other file systems should have a
289.Fa fs_passno
290of 2.
291Filesystems within a drive will be checked sequentially,
292but file systems on different drives will be checked at the
293same time to use parallelism available in the hardware.
294If the sixth field is not present or zero,
295a value of zero is returned and
296.Xr fsck 8
297will assume that the file system does not need to be checked.
298.Bd -literal
299#define	FSTAB_RW	"rw"	/* read-write device */
300#define	FSTAB_RQ	"rq"	/* read/write with quotas */
301#define	FSTAB_RO	"ro"	/* read-only device */
302#define	FSTAB_SW	"sw"	/* swap device */
303#define	FSTAB_DP	"dp"	/* dump device */
304#define	FSTAB_XX	"xx"	/* ignore totally */
305
306struct fstab {
307	char	*fs_spec;	/* block special device name */
308	char	*fs_file;	/* file system path prefix */
309	char	*fs_vfstype;	/* type of file system */
310	char	*fs_mntops;	/* comma separated mount options */
311	char	*fs_type;	/* rw, ro, sw, or xx */
312	int	fs_freq;	/* dump frequency, in days */
313	int	fs_passno;	/* pass number on parallel fsck */
314};
315.Ed
316.Pp
317The proper way to read records from
318.Pa fstab
319is to use the routines
320.Xr getfsent 3 ,
321.Xr getfsspec 3 ,
322and
323.Xr getfsfile 3 .
324.Sh FILES
325.Bl -tag -width /etc/fstab
326.It Pa /etc/fstab
327The location of
328.Nm
329configuration file.
330.It Pa /usr/share/examples/fstab/
331Some useful configuration examples.
332.El
333.Sh SEE ALSO
334.Xr getfsent 3 ,
335.Xr mount 8 ,
336.Xr swapctl 8
337.Sh HISTORY
338The
339.Nm
340file format appeared in
341.Bx 4.0 .
342