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