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