xref: /dflybsd-src/share/man/man5/fstab.5 (revision e54488bbec5c9f80e95cedd395b0e3d31fde253d)
1.\" Copyright (c) 1980, 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
33.\" $FreeBSD: src/share/man/man5/fstab.5,v 1.11.2.8 2003/02/10 12:21:08 des Exp $
34.\" $DragonFly: src/share/man/man5/fstab.5,v 1.5 2008/07/27 21:16:00 thomas Exp $
35.\"
36.Dd July 27, 2008
37.Dt FSTAB 5
38.Os
39.Sh NAME
40.Nm fstab
41.Nd static information about the file systems
42.Sh SYNOPSIS
43.In fstab.h
44.Sh DESCRIPTION
45The file
46.Nm
47contains descriptive information about the various file
48systems.
49.Nm
50is only read by programs, and not written;
51it is the duty of the system administrator to properly create
52and maintain this file.
53Each file system is described on a separate line;
54fields on each line are separated by tabs or spaces.
55The order of records in
56.Nm
57is important because
58.Xr fsck 8 ,
59.Xr mount 8 ,
60and
61.Xr umount 8
62sequentially iterate through
63.Nm
64doing their thing.
65.Pp
66The first field,
67.Pq Fa fs_spec ,
68describes the special file or
69remote file system to be mounted.  This may be a /dev/<path>, a label
70from a devtab (typically /etc/devtab), or a host:path for NFS.
71Note that devtab labels maybe augmented with a ".suffix" trailer.  For
72example "mydisk.s1a".
73Also note /dev based paths can mount serial numbers similar to devtab
74labels by using the path "/dev/serno/SERIALNO[.suffix]".
75.Pp
76The second field,
77.Pq Fa fs_file ,
78describes the mount point for the file system.
79For swap partitions, this field should be specified as
80.Dq none .
81.Pp
82The third field,
83.Pq Fa fs_vfstype ,
84describes the type of the file system.
85The system can support various file system types.
86Only the root,
87.Pa /usr ,
88and
89.Pa /tmp
90file systems need be statically
91compiled into the kernel;
92everything else will be automatically loaded at mount
93time.  (Exception: the UFS family - FFS, MFS, and LFS cannot
94currently be demand-loaded.)  Some people still prefer to statically
95compile other file systems as well.
96.Pp
97The most common file system types are:
98.Bl -tag -width indent -offset indent
99.It Em HAMMER
100a local
101.Xr HAMMER 5
102file system
103.It Em ufs
104a local
105.Xr ffs 5
106.Ux
107file system
108.It Em mfs
109a local memory-based
110.Ux
111file system
112.It Em nfs
113a Sun Microsystems compatible
114.Dq "Network File System"
115.It Em swap
116a disk partition to be used for swapping
117.It Em msdos
118a local
119.Xr msdos 5
120DOS compatible file system
121.It Em cd9660
122a local CD-ROM file system (as per ISO 9660)
123.\" maybe also say Rock Ridge extensions are handled ?
124.It Em procfs
125a file system for accessing process data
126.El
127.Pp
128The fourth field,
129.Pq Fa fs_mntops ,
130describes the mount options associated with the file system.
131It is formatted as a comma separated list of options.
132It contains at least the type of mount (see
133.Fa fs_type
134below) plus any additional options
135appropriate to the file system type.  See the options flag
136.Pq Fl o
137in the
138.Xr mount 8
139page and the file system specific page, such as
140.Xr mount_nfs 8 ,
141for additional options that may be specified.
142.Pp
143If the options ``userquota'' and/or ``groupquota'' are specified,
144the file system is automatically processed by the
145.Xr quotacheck 8
146command, and user and/or group disk quotas are enabled with
147.Xr quotaon 8 .
148By default,
149file system quotas are maintained in files named
150.Pa quota.user
151and
152.Pa quota.group
153which are located at the root of the associated file system.
154These defaults may be overridden by putting an equal sign
155and an alternative absolute pathname following the quota option.
156Thus, if the user quota file for
157.Pa /tmp
158is stored in
159.Pa /var/quotas/tmp.user ,
160this location can be specified as:
161.Bd -literal -offset indent
162userquota=/var/quotas/tmp.user
163.Ed
164.Pp
165If the option ``noauto'' is specified, the file system will not be automatically
166mounted at system startup.
167This is recommended for all remote file systems other than NFS,
168since only NFS mounts are delayed until after network initialization
169by the
170.Xr rc 8
171startup scripts.
172.Pp
173The type of the mount is extracted from the
174.Fa fs_mntops
175field and stored separately in the
176.Fa fs_type
177field (it is not deleted from the
178.Fa fs_mntops
179field).
180If
181.Fa fs_type
182is ``rw'' or ``ro'' then the file system whose name is given in the
183.Fa fs_file
184field is normally mounted read-write or read-only on the
185specified special file.
186If
187.Fa fs_type
188is ``sw'' then the special file is made available as a piece of swap
189space by the
190.Xr swapon 8
191command at the end of the system reboot procedure.
192The fields other than
193.Fa fs_spec
194and
195.Fa fs_type
196are unused.
197If
198.Fa fs_type
199is specified as ``xx'' the entry is ignored.
200This is useful to show disk partitions which are currently unused.
201.Pp
202The fifth field,
203.Pq Fa fs_freq ,
204is used for these file systems by the
205.Xr dump 8
206command to determine which file systems need to be dumped.
207If the fifth field is not present, a value of zero is returned and
208.Nm dump
209will assume that the file system does not need to be dumped.
210.Pp
211The sixth field,
212.Pq Fa fs_passno ,
213is used by the
214.Xr fsck 8
215program to determine the order in which file system checks are done
216at reboot time.
217The root file system should be specified with a
218.Fa fs_passno
219of 1, and other file systems should have a
220.Fa fs_passno
221of 2.
222File systems within a drive will be checked sequentially,
223but file systems on different drives will be checked at the
224same time to utilize parallelism available in the hardware.
225If the sixth field is not present or is zero,
226a value of zero is returned and
227.Xr fsck 8
228will assume that the file system does not need to be checked.
229.Bd -literal
230#define	FSTAB_RW	"rw"	/* read/write device */
231#define	FSTAB_RQ	"rq"	/* read/write with quotas */
232#define	FSTAB_RO	"ro"	/* read-only device */
233#define	FSTAB_SW	"sw"	/* swap device */
234#define	FSTAB_XX	"xx"	/* ignore totally */
235
236struct fstab {
237	char	*fs_spec;	/* block special device name */
238	char	*fs_file;	/* file system path prefix */
239	char	*fs_vfstype;	/* File system type, ufs, nfs */
240	char	*fs_mntops;	/* Mount options ala -o */
241	char	*fs_type;	/* FSTAB_* from fs_mntops */
242	int	fs_freq;	/* dump frequency, in days */
243	int	fs_passno;	/* pass number on parallel fsck */
244};
245.Ed
246.Pp
247The proper way to read records from
248.Nm
249is to use the routines
250.Xr getfsent 3 ,
251.Xr getfsspec 3 ,
252.Xr getfstype 3 ,
253and
254.Xr getfsfile 3 .
255.Sh FILES
256.Bl -tag -width /etc/fstab -compact
257.It Pa /etc/fstab
258The file
259.Nm
260resides in
261.Pa /etc .
262.El
263.Sh SEE ALSO
264.Xr getfsent 3 ,
265.Xr getvfsbyname 3 ,
266.Xr HAMMER 5 ,
267.Xr dump 8 ,
268.Xr fsck 8 ,
269.Xr mount 8 ,
270.Xr quotacheck 8 ,
271.Xr quotaon 8 ,
272.Xr swapon 8 ,
273.Xr umount 8
274.Sh HISTORY
275The
276.Nm
277file format appeared in
278.Bx 4.0 .
279