xref: /freebsd/share/man/man5/fstab.5 (revision df6a289e7639dee6c32b31fa090e261e26af0c56)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1980, 1989, 1991, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
14afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
15afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
16afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18afe61c15SRodney W. Grimes.\"    without specific prior written permission.
19afe61c15SRodney W. Grimes.\"
20afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
31afe61c15SRodney W. Grimes.\"
32afe61c15SRodney W. Grimes.\"     @(#)fstab.5	8.1 (Berkeley) 6/5/93
337f3dea24SPeter Wemm.\" $FreeBSD$
34afe61c15SRodney W. Grimes.\"
35c7383075SXin LI.Dd June 7, 2011
36afe61c15SRodney W. Grimes.Dt FSTAB 5
373d45e180SRuslan Ermilov.Os
38afe61c15SRodney W. Grimes.Sh NAME
39afe61c15SRodney W. Grimes.Nm fstab
40afe61c15SRodney W. Grimes.Nd static information about the file systems
41afe61c15SRodney W. Grimes.Sh SYNOPSIS
4232eef9aeSRuslan Ermilov.In fstab.h
43afe61c15SRodney W. Grimes.Sh DESCRIPTION
44afe61c15SRodney W. GrimesThe file
454b66483fSRuslan Ermilov.Nm
46afe61c15SRodney W. Grimescontains descriptive information about the various file
47afe61c15SRodney W. Grimessystems.
484b66483fSRuslan Ermilov.Nm
49afe61c15SRodney W. Grimesis only read by programs, and not written;
50afe61c15SRodney W. Grimesit is the duty of the system administrator to properly create
51afe61c15SRodney W. Grimesand maintain this file.
52afe61c15SRodney W. GrimesEach file system is described on a separate line;
53afe61c15SRodney W. Grimesfields on each line are separated by tabs or spaces.
54afe61c15SRodney W. GrimesThe order of records in
554b66483fSRuslan Ermilov.Nm
56afe61c15SRodney W. Grimesis important because
57afe61c15SRodney W. Grimes.Xr fsck 8 ,
58afe61c15SRodney W. Grimes.Xr mount 8 ,
59afe61c15SRodney W. Grimesand
60afe61c15SRodney W. Grimes.Xr umount 8
61afe61c15SRodney W. Grimessequentially iterate through
624b66483fSRuslan Ermilov.Nm
63afe61c15SRodney W. Grimesdoing their thing.
64afe61c15SRodney W. Grimes.Pp
65afe61c15SRodney W. GrimesThe first field,
66afe61c15SRodney W. Grimes.Pq Fa fs_spec ,
67f2c05021SMike Pritcharddescribes the special device or
68afe61c15SRodney W. Grimesremote file system to be mounted.
69afe61c15SRodney W. Grimes.Pp
70afe61c15SRodney W. GrimesThe second field,
71afe61c15SRodney W. Grimes.Pq Fa fs_file ,
72afe61c15SRodney W. Grimesdescribes the mount point for the file system.
73*df6a289eSXin LIFor swap partitions, this field should be specified as
74*df6a289eSXin LI.Dq none .
75afe61c15SRodney W. Grimes.Pp
76afe61c15SRodney W. GrimesThe third field,
77afe61c15SRodney W. Grimes.Pq Fa fs_vfstype ,
78afe61c15SRodney W. Grimesdescribes the type of the file system.
79e9387c7dSWolfram SchneiderThe system can support various file system types.
80e9387c7dSWolfram SchneiderOnly the root, /usr, and /tmp file systems need be statically
81e9387c7dSWolfram Schneidercompiled into the kernel;
82e9387c7dSWolfram Schneidereverything else will be automatically loaded at mount
835203edcdSRuslan Ermilovtime.
8475184335SWarner Losh(Exception: the FFS cannot currently be demand-loaded.)
855203edcdSRuslan ErmilovSome people still prefer to statically
86e9387c7dSWolfram Schneidercompile other file systems as well.
87afe61c15SRodney W. Grimes.Pp
88afe61c15SRodney W. GrimesThe fourth field,
89afe61c15SRodney W. Grimes.Pq Fa fs_mntops ,
90afe61c15SRodney W. Grimesdescribes the mount options associated with the file system.
91afe61c15SRodney W. GrimesIt is formatted as a comma separated list of options.
92afe61c15SRodney W. GrimesIt contains at least the type of mount (see
93afe61c15SRodney W. Grimes.Fa fs_type
946e63b508SGiorgos Keramidasbelow) plus any additional options appropriate to the file system type.
955203edcdSRuslan ErmilovSee the options flag
9667ea20edSGuy Helmer.Pq Fl o
9767ea20edSGuy Helmerin the
9867ea20edSGuy Helmer.Xr mount 8
9967ea20edSGuy Helmerpage and the file system specific page, such as
10067ea20edSGuy Helmer.Xr mount_nfs 8 ,
10167ea20edSGuy Helmerfor additional options that may be specified.
1026e63b508SGiorgos KeramidasAll options that can be given to the file system specific mount commands
1036e63b508SGiorgos Keramidascan be used in
1046e63b508SGiorgos Keramidas.Nm
1056e63b508SGiorgos Keramidasas well.
1066e63b508SGiorgos KeramidasThey just need to be formatted a bit differently.
1076e63b508SGiorgos KeramidasThe arguments of the
1086e63b508SGiorgos Keramidas.Fl o
1096e63b508SGiorgos Keramidasoption can be used without the preceding
1106e63b508SGiorgos Keramidas.Fl o
1116e63b508SGiorgos Keramidasflag.
1126e63b508SGiorgos KeramidasOther options need both the file system specific flag and its argument,
1136e63b508SGiorgos Keramidasseparated by an equal sign.
1146e63b508SGiorgos KeramidasFor example, mounting an
1156e63b508SGiorgos Keramidas.Xr msdosfs 5
1166e63b508SGiorgos Keramidasfilesystem, the options
1176e63b508SGiorgos Keramidas.Bd -literal -offset indent
1186e63b508SGiorgos Keramidas-o sync -o noatime -m 644 -M 755 -u foo -g bar
1196e63b508SGiorgos Keramidas.Ed
1206e63b508SGiorgos Keramidas.Pp
1216e63b508SGiorgos Keramidasshould be written as
1226e63b508SGiorgos Keramidas.Bd -literal -offset indent
1236e63b508SGiorgos Keramidassync,noatime,-m=644,-M=755,-u=foo,-g=bar
1246e63b508SGiorgos Keramidas.Ed
1256e63b508SGiorgos Keramidas.Pp
1266e63b508SGiorgos Keramidasin the option field of
1276e63b508SGiorgos Keramidas.Nm .
128afe61c15SRodney W. Grimes.Pp
129*df6a289eSXin LIIf the options
130*df6a289eSXin LI.Dq userquota
131*df6a289eSXin LIand/or
132*df6a289eSXin LI.Dq groupquota
133*df6a289eSXin LIare specified,
134afe61c15SRodney W. Grimesthe file system is automatically processed by the
135afe61c15SRodney W. Grimes.Xr quotacheck 8
136afe61c15SRodney W. Grimescommand, and user and/or group disk quotas are enabled with
137afe61c15SRodney W. Grimes.Xr quotaon 8 .
138afe61c15SRodney W. GrimesBy default,
139afe61c15SRodney W. Grimesfile system quotas are maintained in files named
140afe61c15SRodney W. Grimes.Pa quota.user
141afe61c15SRodney W. Grimesand
142afe61c15SRodney W. Grimes.Pa quota.group
143afe61c15SRodney W. Grimeswhich are located at the root of the associated file system.
144afe61c15SRodney W. GrimesThese defaults may be overridden by putting an equal sign
145afe61c15SRodney W. Grimesand an alternative absolute pathname following the quota option.
146afe61c15SRodney W. GrimesThus, if the user quota file for
147afe61c15SRodney W. Grimes.Pa /tmp
148afe61c15SRodney W. Grimesis stored in
149afe61c15SRodney W. Grimes.Pa /var/quotas/tmp.user ,
150afe61c15SRodney W. Grimesthis location can be specified as:
151afe61c15SRodney W. Grimes.Bd -literal -offset indent
152afe61c15SRodney W. Grimesuserquota=/var/quotas/tmp.user
153afe61c15SRodney W. Grimes.Ed
154afe61c15SRodney W. Grimes.Pp
155*df6a289eSXin LIIf the option
156*df6a289eSXin LI.Dq failok
157*df6a289eSXin LIis specified,
158c7383075SXin LIthe system will ignore any error which happens during the mount of that filesystem,
159c7383075SXin LIwhich would otherwise cause the system to drop into single user mode.
160c7383075SXin LIThis option is implemented by the
161c7383075SXin LI.Xr mount 8
162c7383075SXin LIcommand and will not be passed to the kernel.
163c7383075SXin LI.Pp
164*df6a289eSXin LIIf the option
165*df6a289eSXin LI.Dq noauto
166*df6a289eSXin LIis specified, the file system will not be automatically
167e70db05aSDavid Greenmanmounted at system startup.
1681c2941b2SSheldon HearnNote that, for network file systems
1691c2941b2SSheldon Hearnof third party types
1705203edcdSRuslan Ermilov(i.e., types supported by additional software
1711c2941b2SSheldon Hearnnot included in the base system)
1721c2941b2SSheldon Hearnto be automatically mounted at system startup,
1731c2941b2SSheldon Hearnthe
17463122b7fSRuslan Ermilov.Va extra_netfs_types
1751c2941b2SSheldon Hearn.Xr rc.conf 5
1761c2941b2SSheldon Hearnvariable must be used to extend the
177bb522200SSheldon Hearn.Xr rc 8
1781c2941b2SSheldon Hearnstartup script's list of network file system types.
179e70db05aSDavid Greenman.Pp
180afe61c15SRodney W. GrimesThe type of the mount is extracted from the
181afe61c15SRodney W. Grimes.Fa fs_mntops
182afe61c15SRodney W. Grimesfield and stored separately in the
183afe61c15SRodney W. Grimes.Fa fs_type
184afe61c15SRodney W. Grimesfield (it is not deleted from the
185afe61c15SRodney W. Grimes.Fa fs_mntops
186afe61c15SRodney W. Grimesfield).
187afe61c15SRodney W. GrimesIf
188afe61c15SRodney W. Grimes.Fa fs_type
189*df6a289eSXin LIis
190*df6a289eSXin LI.Dq rw
191*df6a289eSXin LIor
192*df6a289eSXin LI.Dq ro
193*df6a289eSXin LIthen the file system whose name is given in the
194afe61c15SRodney W. Grimes.Fa fs_file
195afe61c15SRodney W. Grimesfield is normally mounted read-write or read-only on the
196afe61c15SRodney W. Grimesspecified special file.
197afe61c15SRodney W. GrimesIf
198afe61c15SRodney W. Grimes.Fa fs_type
199*df6a289eSXin LIis
200*df6a289eSXin LI.Dq sw
201*df6a289eSXin LIthen the special file is made available as a piece of swap
202afe61c15SRodney W. Grimesspace by the
203afe61c15SRodney W. Grimes.Xr swapon 8
204afe61c15SRodney W. Grimescommand at the end of the system reboot procedure.
205afe61c15SRodney W. GrimesThe fields other than
206afe61c15SRodney W. Grimes.Fa fs_spec
207afe61c15SRodney W. Grimesand
208afe61c15SRodney W. Grimes.Fa fs_type
209afe61c15SRodney W. Grimesare unused.
210afe61c15SRodney W. GrimesIf
211afe61c15SRodney W. Grimes.Fa fs_type
212*df6a289eSXin LIis specified as
213*df6a289eSXin LI.Dq xx
214*df6a289eSXin LIthe entry is ignored.
215afe61c15SRodney W. GrimesThis is useful to show disk partitions which are currently unused.
216afe61c15SRodney W. Grimes.Pp
217afe61c15SRodney W. GrimesThe fifth field,
218afe61c15SRodney W. Grimes.Pq Fa fs_freq ,
219afe61c15SRodney W. Grimesis used for these file systems by the
220afe61c15SRodney W. Grimes.Xr dump 8
221afe61c15SRodney W. Grimescommand to determine which file systems need to be dumped.
222afe61c15SRodney W. GrimesIf the fifth field is not present, a value of zero is returned and
223edf0e5b3SMike Pritchard.Nm dump
224afe61c15SRodney W. Grimeswill assume that the file system does not need to be dumped.
225e3fbf603SWarner LoshIf the fifth field is greater than 0, then it specifies the number of days
226e3fbf603SWarner Loshbetween dumps for this file system.
227afe61c15SRodney W. Grimes.Pp
228afe61c15SRodney W. GrimesThe sixth field,
229afe61c15SRodney W. Grimes.Pq Fa fs_passno ,
230afe61c15SRodney W. Grimesis used by the
231afe61c15SRodney W. Grimes.Xr fsck 8
232c980e8b5SMike Pritchardand
233c980e8b5SMike Pritchard.Xr quotacheck 8
2345338828aSMike Pritchardprograms to determine the order in which file system and quota
2355338828aSMike Pritchardchecks are done at reboot time.
2365338828aSMike PritchardThe
2375338828aSMike Pritchard.Fa fs_passno
2385338828aSMike Pritchardfield can be any value between 0 and
2395338828aSMike Pritchard.Ql INT_MAX Ns -1 .
2405338828aSMike Pritchard.Pp
241afe61c15SRodney W. GrimesThe root file system should be specified with a
242afe61c15SRodney W. Grimes.Fa fs_passno
243afe61c15SRodney W. Grimesof 1, and other file systems should have a
244afe61c15SRodney W. Grimes.Fa fs_passno
2455338828aSMike Pritchardof 2 or greater.
2465338828aSMike PritchardA file system with a
2475338828aSMike Pritchard.Fa fs_passno
2485338828aSMike Pritchardvalue of 1 is always checked sequentially and be completed before
2495338828aSMike Pritchardanother file system is processed, and it will be processed before
2505338828aSMike Pritchardall file systems with a larger
2515338828aSMike Pritchard.Fa fs_passno .
2525338828aSMike Pritchard.Pp
253203f7a28SMike PritchardFor any given value of
254203f7a28SMike Pritchard.Fa fs_passno ,
255203f7a28SMike Pritchardfile systems within a drive will be checked sequentially,
256afe61c15SRodney W. Grimesbut file systems on different drives will be checked at the
257afe61c15SRodney W. Grimessame time to utilize parallelism available in the hardware.
258203f7a28SMike PritchardOnce all file system checks are complete for the current
259203f7a28SMike Pritchard.Fa fs_passno ,
260203f7a28SMike Pritchardthe same process will start over for the next
261203f7a28SMike Pritchard.Fa fs_passno .
262203f7a28SMike Pritchard.Pp
2634043c58eSTim VanderhoekIf the sixth field is not present or is zero,
264afe61c15SRodney W. Grimesa value of zero is returned and
265edf0e5b3SMike Pritchard.Xr fsck 8
266c980e8b5SMike Pritchardand
267c980e8b5SMike Pritchard.Xr quotacheck 8
268afe61c15SRodney W. Grimeswill assume that the file system does not need to be checked.
2695338828aSMike Pritchard.Pp
2705338828aSMike PritchardThe
2715338828aSMike Pritchard.Fa fs_passno
2725338828aSMike Pritchardfield can be used to implement finer control when
2735338828aSMike Pritchardthe system utilities may determine that the file system resides
2745338828aSMike Pritchardon a different physical device, when it actually does not, as with a
2755338828aSMike Pritchard.Xr ccd 4
2765338828aSMike Pritcharddevice.
277203f7a28SMike PritchardAll file systems with a lower
278203f7a28SMike Pritchard.Fa fs_passno
279203f7a28SMike Pritchardvalue will be completed before starting on file systems with a
280203f7a28SMike Pritchardhigher
281203f7a28SMike Pritchard.Fa fs_passno
282203f7a28SMike Pritchardvalue.
283203f7a28SMike PritchardE.g. all file systems with a
284203f7a28SMike Pritchard.Fa fs_passno
285203f7a28SMike Pritchardof 2 will be completed before any file systems with a
286203f7a28SMike Pritchard.Fa fs_passno
287203f7a28SMike Pritchardof 3 or greater are started.
288203f7a28SMike PritchardGaps are allowed between the different
289203f7a28SMike Pritchard.Fa fs_passno
290203f7a28SMike Pritchardvalues.
291203f7a28SMike PritchardE.g. file systems listed in
292203f7a28SMike Pritchard.Pa /etc/fstab
293203f7a28SMike Pritchardmay have
294203f7a28SMike Pritchard.Fa fs_passno
295203f7a28SMike Pritchardvalues such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order
296203f7a28SMike Pritchardwithin
297203f7a28SMike Pritchard.Pa /etc/fstab .
298afe61c15SRodney W. Grimes.Bd -literal
299ad2c737eSMike Pritchard#define	FSTAB_RW	"rw"	/* read/write device */
300ad2c737eSMike Pritchard#define	FSTAB_RQ	"rq"	/* read/write with quotas */
301afe61c15SRodney W. Grimes#define	FSTAB_RO	"ro"	/* read-only device */
302afe61c15SRodney W. Grimes#define	FSTAB_SW	"sw"	/* swap device */
303afe61c15SRodney W. Grimes#define	FSTAB_XX	"xx"	/* ignore totally */
304afe61c15SRodney W. Grimes
305afe61c15SRodney W. Grimesstruct fstab {
306afe61c15SRodney W. Grimes	char	*fs_spec;	/* block special device name */
307afe61c15SRodney W. Grimes	char	*fs_file;	/* file system path prefix */
308ad2c737eSMike Pritchard	char	*fs_vfstype;	/* File system type, ufs, nfs */
309ad2c737eSMike Pritchard	char	*fs_mntops;	/* Mount options ala -o */
310ad2c737eSMike Pritchard	char	*fs_type;	/* FSTAB_* from fs_mntops */
311afe61c15SRodney W. Grimes	int	fs_freq;	/* dump frequency, in days */
312ad2c737eSMike Pritchard	int	fs_passno;	/* pass number on parallel fsck */
313afe61c15SRodney W. Grimes};
314afe61c15SRodney W. Grimes.Ed
315afe61c15SRodney W. Grimes.Pp
316afe61c15SRodney W. GrimesThe proper way to read records from
317afe61c15SRodney W. Grimes.Pa fstab
318afe61c15SRodney W. Grimesis to use the routines
319afe61c15SRodney W. Grimes.Xr getfsent 3 ,
320afe61c15SRodney W. Grimes.Xr getfsspec 3 ,
321afe61c15SRodney W. Grimes.Xr getfstype 3 ,
322afe61c15SRodney W. Grimesand
323afe61c15SRodney W. Grimes.Xr getfsfile 3 .
324afe61c15SRodney W. Grimes.Sh FILES
325afe61c15SRodney W. Grimes.Bl -tag -width /etc/fstab -compact
326afe61c15SRodney W. Grimes.It Pa /etc/fstab
327afe61c15SRodney W. GrimesThe file
3284b66483fSRuslan Ermilov.Nm
329afe61c15SRodney W. Grimesresides in
330afe61c15SRodney W. Grimes.Pa /etc .
331afe61c15SRodney W. Grimes.El
332afe61c15SRodney W. Grimes.Sh SEE ALSO
333e9387c7dSWolfram Schneider.Xr getfsent 3 ,
334e9387c7dSWolfram Schneider.Xr getvfsbyname 3 ,
3355338828aSMike Pritchard.Xr ccd 4 ,
336e9387c7dSWolfram Schneider.Xr dump 8 ,
337e9387c7dSWolfram Schneider.Xr fsck 8 ,
338e9387c7dSWolfram Schneider.Xr mount 8 ,
339e9387c7dSWolfram Schneider.Xr quotacheck 8 ,
340e9387c7dSWolfram Schneider.Xr quotaon 8 ,
341e9387c7dSWolfram Schneider.Xr swapon 8 ,
3426fe89339SBen Smithurst.Xr umount 8
343afe61c15SRodney W. Grimes.Sh HISTORY
344afe61c15SRodney W. GrimesThe
345afe61c15SRodney W. Grimes.Nm
346afe61c15SRodney W. Grimesfile format appeared in
347afe61c15SRodney W. Grimes.Bx 4.0 .
348