]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - share/man/man5/fstab.5
MFC r362623:
[FreeBSD/stable/8.git] / share / man / man5 / fstab.5
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$
34 .\"
35 .Dd June 7, 2011
36 .Dt FSTAB 5
37 .Os
38 .Sh NAME
39 .Nm fstab
40 .Nd static information about the file systems
41 .Sh SYNOPSIS
42 .In fstab.h
43 .Sh DESCRIPTION
44 The file
45 .Nm
46 contains descriptive information about the various file
47 systems.
48 .Nm
49 is only read by programs, and not written;
50 it is the duty of the system administrator to properly create
51 and maintain this file.
52 Each file system is described on a separate line;
53 fields on each line are separated by tabs or spaces.
54 The order of records in
55 .Nm
56 is important because
57 .Xr fsck 8 ,
58 .Xr mount 8 ,
59 and
60 .Xr umount 8
61 sequentially iterate through
62 .Nm
63 doing their thing.
64 .Pp
65 The first field,
66 .Pq Fa fs_spec ,
67 describes the special device or
68 remote file system to be mounted.
69 .Pp
70 The second field,
71 .Pq Fa fs_file ,
72 describes the mount point for the file system.
73 For swap partitions, this field should be specified as ``none''.
74 .Pp
75 The third field,
76 .Pq Fa fs_vfstype ,
77 describes the type of the file system.
78 The system can support various file system types.
79 Only the root, /usr, and /tmp file systems need be statically
80 compiled into the kernel;
81 everything else will be automatically loaded at mount
82 time.
83 (Exception: the FFS cannot currently be demand-loaded.)
84 Some people still prefer to statically
85 compile other file systems as well.
86 .Pp
87 The fourth field,
88 .Pq Fa fs_mntops ,
89 describes the mount options associated with the file system.
90 It is formatted as a comma separated list of options.
91 It contains at least the type of mount (see
92 .Fa fs_type
93 below) plus any additional options appropriate to the file system type.
94 See the options flag
95 .Pq Fl o
96 in the
97 .Xr mount 8
98 page and the file system specific page, such as
99 .Xr mount_nfs 8 ,
100 for additional options that may be specified.
101 All options that can be given to the file system specific mount commands
102 can be used in
103 .Nm
104 as well.
105 They just need to be formatted a bit differently.
106 The arguments of the
107 .Fl o
108 option can be used without the preceding
109 .Fl o
110 flag.
111 Other options need both the file system specific flag and its argument,
112 separated by an equal sign.
113 For example, mounting an
114 .Xr msdosfs 5
115 filesystem, the options
116 .Bd -literal -offset indent
117 -o sync -o noatime -m 644 -M 755 -u foo -g bar
118 .Ed
119 .Pp
120 should be written as
121 .Bd -literal -offset indent
122 sync,noatime,-m=644,-M=755,-u=foo,-g=bar
123 .Ed
124 .Pp
125 in the option field of
126 .Nm .
127 .Pp
128 If the options ``userquota'' and/or ``groupquota'' are specified,
129 the file system is automatically processed by the
130 .Xr quotacheck 8
131 command, and user and/or group disk quotas are enabled with
132 .Xr quotaon 8 .
133 By default,
134 file system quotas are maintained in files named
135 .Pa quota.user
136 and
137 .Pa quota.group
138 which are located at the root of the associated file system.
139 These defaults may be overridden by putting an equal sign
140 and an alternative absolute pathname following the quota option.
141 Thus, if the user quota file for
142 .Pa /tmp
143 is stored in
144 .Pa /var/quotas/tmp.user ,
145 this location can be specified as:
146 .Bd -literal -offset indent
147 userquota=/var/quotas/tmp.user
148 .Ed
149 .Pp
150 If the option ``failok'' is specified,
151 the system will ignore any error which happens during the mount of that filesystem,
152 which would otherwise cause the system to drop into single user mode.
153 This option is implemented by the
154 .Xr mount 8
155 command and will not be passed to the kernel.
156 .Pp
157 If the option ``noauto'' is specified, the file system will not be automatically
158 mounted at system startup.
159 Note that, for network file systems
160 of third party types
161 (i.e., types supported by additional software
162 not included in the base system)
163 to be automatically mounted at system startup,
164 the
165 .Va extra_netfs_types
166 .Xr rc.conf 5
167 variable must be used to extend the
168 .Xr rc 8
169 startup script's list of network file system types.
170 .Pp
171 The type of the mount is extracted from the
172 .Fa fs_mntops
173 field and stored separately in the
174 .Fa fs_type
175 field (it is not deleted from the
176 .Fa fs_mntops
177 field).
178 If
179 .Fa fs_type
180 is ``rw'' or ``ro'' then the file system whose name is given in the
181 .Fa fs_file
182 field is normally mounted read-write or read-only on the
183 specified special file.
184 If
185 .Fa fs_type
186 is ``sw'' then the special file is made available as a piece of swap
187 space by the
188 .Xr swapon 8
189 command at the end of the system reboot procedure.
190 The fields other than
191 .Fa fs_spec
192 and
193 .Fa fs_type
194 are unused.
195 If
196 .Fa fs_type
197 is specified as ``xx'' the entry is ignored.
198 This is useful to show disk partitions which are currently unused.
199 .Pp
200 The fifth field,
201 .Pq Fa fs_freq ,
202 is used for these file systems by the
203 .Xr dump 8
204 command to determine which file systems need to be dumped.
205 If the fifth field is not present, a value of zero is returned and
206 .Nm dump
207 will assume that the file system does not need to be dumped.
208 If the fifth field is greater than 0, then it specifies the number of days
209 between dumps for this file system.
210 .Pp
211 The sixth field,
212 .Pq Fa fs_passno ,
213 is used by the
214 .Xr fsck 8
215 and
216 .Xr quotacheck 8
217 programs to determine the order in which file system and quota
218 checks are done at reboot time.
219 The
220 .Fa fs_passno
221 field can be any value between 0 and 
222 .Ql INT_MAX Ns -1 .
223 .Pp
224 The root file system should be specified with a
225 .Fa fs_passno
226 of 1, and other file systems should have a
227 .Fa fs_passno
228 of 2 or greater.
229 A file system with a
230 .Fa fs_passno
231 value of 1 is always checked sequentially and be completed before 
232 another file system is processed, and it will be processed before
233 all file systems with a larger
234 .Fa fs_passno .
235 .Pp
236 For any given value of
237 .Fa fs_passno ,
238 file systems within a drive will be checked sequentially,
239 but file systems on different drives will be checked at the
240 same time to utilize parallelism available in the hardware.
241 Once all file system checks are complete for the current
242 .Fa fs_passno ,
243 the same process will start over for the next
244 .Fa fs_passno .
245 .Pp
246 If the sixth field is not present or is zero,
247 a value of zero is returned and
248 .Xr fsck 8
249 and
250 .Xr quotacheck 8
251 will assume that the file system does not need to be checked.
252 .Pp
253 The
254 .Fa fs_passno
255 field can be used to implement finer control when 
256 the system utilities may determine that the file system resides
257 on a different physical device, when it actually does not, as with a
258 .Xr ccd 4
259 device.
260 All file systems with a lower
261 .Fa fs_passno
262 value will be completed before starting on file systems with a
263 higher
264 .Fa fs_passno
265 value.
266 E.g. all file systems with a
267 .Fa fs_passno
268 of 2 will be completed before any file systems with a
269 .Fa fs_passno
270 of 3 or greater are started.
271 Gaps are allowed between the different
272 .Fa fs_passno
273 values.
274 E.g. file systems listed in
275 .Pa /etc/fstab
276 may have
277 .Fa fs_passno
278 values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order
279 within
280 .Pa /etc/fstab .
281 .Bd -literal
282 #define FSTAB_RW        "rw"    /* read/write device */
283 #define FSTAB_RQ        "rq"    /* read/write with quotas */
284 #define FSTAB_RO        "ro"    /* read-only device */
285 #define FSTAB_SW        "sw"    /* swap device */
286 #define FSTAB_XX        "xx"    /* ignore totally */
287
288 struct fstab {
289         char    *fs_spec;       /* block special device name */
290         char    *fs_file;       /* file system path prefix */
291         char    *fs_vfstype;    /* File system type, ufs, nfs */
292         char    *fs_mntops;     /* Mount options ala -o */
293         char    *fs_type;       /* FSTAB_* from fs_mntops */
294         int     fs_freq;        /* dump frequency, in days */
295         int     fs_passno;      /* pass number on parallel fsck */
296 };
297 .Ed
298 .Pp
299 The proper way to read records from
300 .Pa fstab
301 is to use the routines
302 .Xr getfsent 3 ,
303 .Xr getfsspec 3 ,
304 .Xr getfstype 3 ,
305 and
306 .Xr getfsfile 3 .
307 .Sh FILES
308 .Bl -tag -width /etc/fstab -compact
309 .It Pa /etc/fstab
310 The file
311 .Nm
312 resides in
313 .Pa /etc .
314 .El
315 .Sh SEE ALSO
316 .Xr getfsent 3 ,
317 .Xr getvfsbyname 3 ,
318 .Xr ccd 4 ,
319 .Xr dump 8 ,
320 .Xr fsck 8 ,
321 .Xr mount 8 ,
322 .Xr quotacheck 8 ,
323 .Xr quotaon 8 ,
324 .Xr swapon 8 ,
325 .Xr umount 8
326 .Sh HISTORY
327 The
328 .Nm
329 file format appeared in
330 .Bx 4.0 .