]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man5/fstab.5
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 September 10, 2013
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 The contents are decoded by the
70 .Xr strunvis 3
71 function.
72 This allows using spaces or tabs in the device name which would be
73 interpreted as field separators otherwise.
74 .Pp
75 The second field,
76 .Pq Fa fs_file ,
77 describes the mount point for the file system.
78 For swap partitions, this field should be specified as
79 .Dq none .
80 The contents are decoded by the
81 .Xr strunvis 3
82 function, as above.
83 .Pp
84 The third field,
85 .Pq Fa fs_vfstype ,
86 describes the type of the file system.
87 The system can support various file system types.
88 Only the root, /usr, and /tmp file systems need be statically
89 compiled into the kernel;
90 everything else will be automatically loaded at mount
91 time.
92 (Exception: the FFS cannot currently be demand-loaded.)
93 Some people still prefer to statically
94 compile other file systems as well.
95 .Pp
96 The fourth field,
97 .Pq Fa fs_mntops ,
98 describes the mount options associated with the file system.
99 It is formatted as a comma separated list of options.
100 It contains at least the type of mount (see
101 .Fa fs_type
102 below) plus any additional options appropriate to the file system type.
103 See the options flag
104 .Pq Fl o
105 in the
106 .Xr mount 8
107 page and the file system specific page, such as
108 .Xr mount_nfs 8 ,
109 for additional options that may be specified.
110 All options that can be given to the file system specific mount commands
111 can be used in
112 .Nm
113 as well.
114 They just need to be formatted a bit differently.
115 The arguments of the
116 .Fl o
117 option can be used without the preceding
118 .Fl o
119 flag.
120 Other options need both the file system specific flag and its argument,
121 separated by an equal sign.
122 For example, mounting an
123 .Xr msdosfs 5
124 filesystem, the options
125 .Bd -literal -offset indent
126 -o sync -o noatime -m 644 -M 755 -u foo -g bar
127 .Ed
128 .Pp
129 should be written as
130 .Bd -literal -offset indent
131 sync,noatime,-m=644,-M=755,-u=foo,-g=bar
132 .Ed
133 .Pp
134 in the option field of
135 .Nm .
136 .Pp
137 If the options
138 .Dq userquota
139 and/or
140 .Dq groupquota
141 are specified,
142 the file system is automatically processed by the
143 .Xr quotacheck 8
144 command, and user and/or group disk quotas are enabled with
145 .Xr quotaon 8 .
146 By default,
147 file system quotas are maintained in files named
148 .Pa quota.user
149 and
150 .Pa quota.group
151 which are located at the root of the associated file system.
152 These defaults may be overridden by putting an equal sign
153 and an alternative absolute pathname following the quota option.
154 Thus, if the user quota file for
155 .Pa /tmp
156 is stored in
157 .Pa /var/quotas/tmp.user ,
158 this location can be specified as:
159 .Bd -literal -offset indent
160 userquota=/var/quotas/tmp.user
161 .Ed
162 .Pp
163 If the option
164 .Dq failok
165 is specified,
166 the system will ignore any error which happens during the mount of that filesystem,
167 which would otherwise cause the system to drop into single user mode.
168 This option is implemented by the
169 .Xr mount 8
170 command and will not be passed to the kernel.
171 .Pp
172 If the option
173 .Dq noauto
174 is specified, the file system will not be automatically
175 mounted at system startup.
176 Note that, for network file systems
177 of third party types
178 (i.e., types supported by additional software
179 not included in the base system)
180 to be automatically mounted at system startup,
181 the
182 .Va extra_netfs_types
183 .Xr rc.conf 5
184 variable must be used to extend the
185 .Xr rc 8
186 startup script's list of network file system types.
187 .Pp
188 If the option
189 .Dq late
190 is specified, the file system will be automatically mounted
191 at a stage of system startup after remote mount points are mounted.
192 For more detail about this option,
193 see the
194 .Xr mount 8
195 manual page.
196 .Pp
197 The type of the mount is extracted from the
198 .Fa fs_mntops
199 field and stored separately in the
200 .Fa fs_type
201 field (it is not deleted from the
202 .Fa fs_mntops
203 field).
204 If
205 .Fa fs_type
206 is
207 .Dq rw
208 or
209 .Dq ro
210 then the file system whose name is given in the
211 .Fa fs_file
212 field is normally mounted read-write or read-only on the
213 specified special file.
214 .Pp
215 If
216 .Fa fs_type
217 is
218 .Dq sw
219 then the special file is made available as a piece of swap
220 space by the
221 .Xr swapon 8
222 command at the end of the system reboot procedure.
223 For vnode-backed swap spaces,
224 .Dq file
225 is supported in the
226 .Fa fs_mntops
227 field.
228 When
229 .Fa fs_spec
230 is an
231 .Xr md 4
232 device file
233 .Pq Do md Dc or Do md[0-9]* Dc
234 and
235 .Dq file
236 is specified in
237 .Fa fs_mntopts ,
238 an
239 .Xr md 4
240 device is created with the specified file used as backing store,
241 and then the new device is used as swap space.
242 Swap entries on
243 .Pa .eli
244 devices will cause automatic creation of encrypted devices.
245 The
246 .Dq ealgo ,
247 .Dq aalgo ,
248 .Dq keylength ,
249 and
250 .Dq sectorsize
251 options may be passed to control those
252 .Xr geli 8
253 parameters.
254 The fields other than
255 .Fa fs_spec
256 and
257 .Fa fs_type
258 are unused.
259 If
260 .Fa fs_type
261 is specified as
262 .Dq xx
263 the entry is ignored.
264 This is useful to show disk partitions which are currently unused.
265 .Pp
266 The fifth field,
267 .Pq Fa fs_freq ,
268 is used for these file systems by the
269 .Xr dump 8
270 command to determine which file systems need to be dumped.
271 If the fifth field is not present, a value of zero is returned and
272 .Nm dump
273 will assume that the file system does not need to be dumped.
274 If the fifth field is greater than 0, then it specifies the number of days
275 between dumps for this file system.
276 .Pp
277 The sixth field,
278 .Pq Fa fs_passno ,
279 is used by the
280 .Xr fsck 8
281 and
282 .Xr quotacheck 8
283 programs to determine the order in which file system and quota
284 checks are done at reboot time.
285 The
286 .Fa fs_passno
287 field can be any value between 0 and
288 .Ql INT_MAX Ns -1 .
289 .Pp
290 The root file system should be specified with a
291 .Fa fs_passno
292 of 1, and other file systems should have a
293 .Fa fs_passno
294 of 2 or greater.
295 A file system with a
296 .Fa fs_passno
297 value of 1 is always checked sequentially and be completed before
298 another file system is processed, and it will be processed before
299 all file systems with a larger
300 .Fa fs_passno .
301 .Pp
302 For any given value of
303 .Fa fs_passno ,
304 file systems within a drive will be checked sequentially,
305 but file systems on different drives will be checked at the
306 same time to utilize parallelism available in the hardware.
307 Once all file system checks are complete for the current
308 .Fa fs_passno ,
309 the same process will start over for the next
310 .Fa fs_passno .
311 .Pp
312 If the sixth field is not present or is zero,
313 a value of zero is returned and
314 .Xr fsck 8
315 and
316 .Xr quotacheck 8
317 will assume that the file system does not need to be checked.
318 .Pp
319 The
320 .Fa fs_passno
321 field can be used to implement finer control when
322 the system utilities may determine that the file system resides
323 on a different physical device, when it actually does not, as with a
324 .Xr ccd 4
325 device.
326 All file systems with a lower
327 .Fa fs_passno
328 value will be completed before starting on file systems with a
329 higher
330 .Fa fs_passno
331 value.
332 E.g. all file systems with a
333 .Fa fs_passno
334 of 2 will be completed before any file systems with a
335 .Fa fs_passno
336 of 3 or greater are started.
337 Gaps are allowed between the different
338 .Fa fs_passno
339 values.
340 E.g. file systems listed in
341 .Pa /etc/fstab
342 may have
343 .Fa fs_passno
344 values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order
345 within
346 .Pa /etc/fstab .
347 .Bd -literal
348 #define FSTAB_RW        "rw"    /* read/write device */
349 #define FSTAB_RQ        "rq"    /* read/write with quotas */
350 #define FSTAB_RO        "ro"    /* read-only device */
351 #define FSTAB_SW        "sw"    /* swap device */
352 #define FSTAB_XX        "xx"    /* ignore totally */
353
354 struct fstab {
355         char    *fs_spec;       /* block special device name */
356         char    *fs_file;       /* file system path prefix */
357         char    *fs_vfstype;    /* File system type, ufs, nfs */
358         char    *fs_mntops;     /* Mount options ala -o */
359         char    *fs_type;       /* FSTAB_* from fs_mntops */
360         int     fs_freq;        /* dump frequency, in days */
361         int     fs_passno;      /* pass number on parallel fsck */
362 };
363 .Ed
364 .Pp
365 The proper way to read records from
366 .Pa fstab
367 is to use the routines
368 .Xr getfsent 3 ,
369 .Xr getfsspec 3 ,
370 .Xr getfstype 3 ,
371 and
372 .Xr getfsfile 3 .
373 .Sh FILES
374 .Bl -tag -width /etc/fstab -compact
375 .It Pa /etc/fstab
376 The file
377 .Nm
378 resides in
379 .Pa /etc .
380 .El
381 .Sh EXAMPLES
382 .Bd -literal
383 # Device        Mountpoint      FStype  Options         Dump    Pass#
384 #
385 # UFS file system.
386 /dev/da0p2      /               ufs     rw              1       1
387 #
388 # Swap space on a block device.
389 /dev/da0p1      none            swap    sw              0       0
390 #
391 # Swap space using a block device with GBDE/GELI encyption.
392 # aalgo, ealgo, keylen, sectorsize options are available
393 # for .eli devices.
394 /dev/da1p1.bde  none            swap    sw              0       0
395 /dev/da1p2.eli  none            swap    sw              0       0
396 #
397 # tmpfs.
398 tmpfs           /tmp            tmpfs   rw,size=1g,mode=1777    0 0
399 #
400 # UFS file system on a swap-backed md(4).  /dev/md10 is
401 # automatically created.  If it is "md", a unit number
402 # will be automatically selected.
403 md10            /scratch        mfs     rw,-s1g         0       0
404 #
405 # Swap space on a vnode-backed md(4).
406 md11            none            swap    sw,file=/swapfile       0 0
407 #
408 # CDROM.  "noauto" option is typically used because the
409 # media is removable.
410 /dev/cd0        /cdrom          cd9660  ro,noauto       0       0
411 #
412 # NFS-exported file system.  "serv" is an NFS server name
413 # or IP address.
414 serv:/export    /nfs            nfs     rw,noinet6      0       0
415 .Ed
416 .Sh SEE ALSO
417 .Xr getfsent 3 ,
418 .Xr getvfsbyname 3 ,
419 .Xr strunvis 3 ,
420 .Xr ccd 4 ,
421 .Xr dump 8 ,
422 .Xr fsck 8 ,
423 .Xr geli 8 ,
424 .Xr mount 8 ,
425 .Xr quotacheck 8 ,
426 .Xr quotaon 8 ,
427 .Xr swapon 8 ,
428 .Xr umount 8
429 .Sh HISTORY
430 The
431 .Nm
432 file format appeared in
433 .Bx 4.0 .