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