xref: /netbsd-src/share/man/man5/fstab.5 (revision 4d12bfcd155352508213ace5ccc59ce930ea2974)
1.\"	$NetBSD: fstab.5,v 1.42 2012/08/12 17:13:34 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 August 12, 2012
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
86If the first field is of the form
87.Dq NAME=<value>
88then all the
89.Xr dk 4
90wedge partitions are searched for one that has a wedge name equal to
91.Ar <value>
92and the device corresponding to it is selected.
93.Pp
94The second field,
95.Pq Fa fs_file ,
96describes the mount point for the file system.
97For swap and dump partitions, this field should be specified as
98.Dq none .
99.Pp
100The third field,
101.Pq Fa fs_vfstype ,
102describes the type of the file system.
103The system currently supports these file systems:
104.Bl -tag -width filecore -offset indent
105.It Em adosfs
106an
107.Tn AmigaDOS
108file system.
109.It Em cd9660
110an
111.Tn ISO
1129660 CD-ROM file system.
113.It Em ext2fs
114an implementation of the Linux
115.Dq Second Extended File-system .
116.It Em fdesc
117an implementation of
118.Pa /dev/fd .
119.It Em ffs
120a local
121.Ux
122file system.
123.It Em filecore
124a file system for
125.Tn RISC\ OS .
126.It Em kernfs
127various and sundry kernel statistics.
128.It Em lfs
129a log-structured file-system.
130.It Em mfs
131a local memory-based
132.Ux
133file system.
134.It Em msdos
135an
136.Tn MS-DOS
137.Dq FAT file system .
138.It Em nfs
139a Sun Microsystems compatible
140.Dq Network File System .
141.It Em ntfs
142a file system used by
143.Tn Windows NT .
144Still experimental.
145.It Em null
146a loop-back file system, allowing parts of the system to be viewed
147elsewhere.
148.It Em overlay
149a demonstration of layered file systems.
150.It Em portal
151a general file system interface, currently supports TCP and FS mounts.
152.It Em procfs
153a local file system of process information.
154.It Em ptyfs
155a pseudo-terminal device file system.
156.It Em smbfs
157a shared resource from an SMB/CIFS file server.
158.It Em swap
159a disk partition to be used for swapping and paging.
160.It Em tmpfs
161an efficient memory file system.
162.It Em umap
163a user and group re-mapping file system.
164.It Em union
165a translucent file system.
166.El
167.Pp
168The fourth field,
169.Pq Fa fs_mntops ,
170describes the mount options associated with the file system.
171It is formatted as a comma separated list of options.
172It contains at least the type of mount (see
173.Fa fs_type
174below) plus any additional options
175appropriate to the file system type.
176.Pp
177The option
178.Dq auto
179can be used in the
180.Dq noauto
181form to cause
182a file system not to be mounted automatically (with
183.Dq mount -a
184,
185or system boot time).
186.Pp
187If the options
188.Dq userquota
189and/or
190.Dq groupquota
191are specified,
192the file system is automatically processed by the
193.Xr quotacheck 8
194command, and legacy user and/or group disk quotas are enabled with
195.Xr quotaon 8 .
196By default,
197file system quotas are maintained in files named
198.Pa quota.user
199and
200.Pa quota.group
201which are located at the root of the associated file system.
202These defaults may be overridden by putting an equal sign
203and an alternative absolute pathname following the quota option.
204Thus, if the user quota file for
205.Pa /tmp
206is stored in
207.Pa /var/quotas/tmp.user ,
208this location can be specified as:
209.Bd -literal -offset indent
210userquota=/var/quotas/tmp.user
211.Ed
212.Pp
213It is recommended to turn on the new, in-file system quota with
214.Xr tunefs 8
215or at
216.Xr newfs 8
217time, and to not use the
218.Dq userquota
219or
220.Dq groupquota
221options.
222Migration of limits to the new in-file system quota can be handled
223via
224.Xr quotadump 8
225and
226.Xr quotarestore 8 .
227.Pp
228The option
229.Dq rump
230is used to mount the file system using a
231.Xr rump 3
232userspace server instead of the kernel server.
233.Pp
234The type of the mount is extracted from the
235.Fa fs_mntops
236field and stored separately in the
237.Fa fs_type
238field (it is not deleted from the
239.Fa fs_mntops
240field).
241If
242.Fa fs_type
243is
244.Dq rw
245or
246.Dq ro
247then the file system whose name is given in the
248.Fa fs_file
249field is normally mounted read-write or read-only on the
250specified special file.
251If
252.Fa fs_type
253is
254.Dq sw
255or
256.Dq dp
257then the special file is made available as a piece of swap
258or dump
259space by the
260.Xr swapctl 8
261command towards the beginning of the system reboot procedure.
262See
263.Xr swapctl 8
264for more information on configuring swap and dump devices.
265The fields other than
266.Fa fs_spec
267and
268.Fa fs_type
269are unused.
270If
271.Fa fs_type
272is specified as
273.Dq xx
274the entry is ignored.
275This is useful to show disk partitions which are currently unused.
276.Pp
277The fifth field,
278.Pq Fa fs_freq ,
279is used for these file systems by the
280.Xr dump 8
281command to determine which file systems need to be dumped.
282If the fifth field is not present, a value of zero is returned and
283.Xr dump 8
284will assume that the file system does not need to be dumped.
285.Pp
286The sixth field,
287.Pq Fa fs_passno ,
288is used by the
289.Xr fsck 8
290program to determine the order in which file system checks are done
291at reboot time.
292The root file system should be specified with a
293.Fa fs_passno
294of 1, and other file systems should have a
295.Fa fs_passno
296of 2.
297Filesystems within a drive will be checked sequentially,
298but file systems on different drives will be checked at the
299same time to use parallelism available in the hardware.
300If the sixth field is not present or zero,
301a value of zero is returned and
302.Xr fsck 8
303will assume that the file system does not need to be checked.
304.Bd -literal
305#define	FSTAB_RW	"rw"	/* read-write device */
306#define	FSTAB_RQ	"rq"	/* read/write with quotas */
307#define	FSTAB_RO	"ro"	/* read-only device */
308#define	FSTAB_SW	"sw"	/* swap device */
309#define	FSTAB_DP	"dp"	/* dump device */
310#define	FSTAB_XX	"xx"	/* ignore totally */
311
312struct fstab {
313	char	*fs_spec;	/* block special device name */
314	char	*fs_file;	/* file system path prefix */
315	char	*fs_vfstype;	/* type of file system */
316	char	*fs_mntops;	/* comma separated mount options */
317	char	*fs_type;	/* rw, ro, sw, or xx */
318	int	fs_freq;	/* dump frequency, in days */
319	int	fs_passno;	/* pass number on parallel fsck */
320};
321.Ed
322.Pp
323The proper way to read records from
324.Pa fstab
325is to use the routines
326.Xr getfsent 3 ,
327.Xr getfsspec 3 ,
328and
329.Xr getfsfile 3 .
330.Sh FILES
331.Bl -tag -width /etc/fstab
332.It Pa /etc/fstab
333The location of
334.Nm
335configuration file.
336.It Pa /usr/share/examples/fstab/
337Some useful configuration examples.
338.El
339.Sh EXAMPLES
340To use
341.Dq NAME
342on a non-GPT disk, use:
343.Bd -literal
344NAME=sb2k5Root/a        /       ffs     rw,log           1 1
345NAME=sb2k5Root/b        none    swap    sw,dp            0 0
346.Ed
347For a
348.Xr gpt 8
349disk, use:
350.Bd -literal
351NAME=firstpartition     /       ffs     rw,log           1 1
352NAME=secondpartition    none    swap    sw,dp            0 0
353.Ed
354.Sh SEE ALSO
355.Xr getfsent 3 ,
356.Xr getfsspecname 3 ,
357.Xr mount 8 ,
358.Xr swapctl 8
359.Sh HISTORY
360The
361.Nm
362file format appeared in
363.Bx 4.0 .
364