nrelease - fix/improve livecd
[dragonfly.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. 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 .\"
31 .Dd March 20, 2020
32 .Dt FSTAB 5
33 .Os
34 .Sh NAME
35 .Nm fstab
36 .Nd static information about the file systems
37 .Sh SYNOPSIS
38 .In fstab.h
39 .Sh DESCRIPTION
40 The file
41 .Nm
42 contains descriptive information about the various file
43 systems.
44 .Nm
45 is only read by programs, and not written;
46 it is the duty of the system administrator to properly create
47 and maintain this file.
48 Each file system is described on a separate line;
49 fields on each line are separated by tabs or spaces.
50 The order of records in
51 .Nm
52 is important because
53 .Xr fsck 8 ,
54 .Xr mount 8 ,
55 and
56 .Xr umount 8
57 sequentially iterate through
58 .Nm
59 doing their thing.
60 .Pp
61 The first field,
62 .Pq Fa fs_spec ,
63 describes the special file or
64 remote file system to be mounted.
65 This may be a
66 .Pa /dev/<path> ,
67 a label from a
68 .Xr devtab 5
69 (typically
70 .Pa /etc/devtab ) ,
71 or a
72 .Pa <host>:<path>
73 for NFS.
74 Note that
75 .Xr devtab 5
76 labels maybe augmented with a
77 .Pa .suffix
78 trailer.
79 For example
80 .Pa mydisk.s1a .
81 Also note
82 .Pa /dev
83 based paths can mount serial numbers similar to
84 .Xr devtab 5
85 labels by using the path
86 .Pa /dev/serno/SERIALNO[.suffix] .
87 .Pp
88 The second field,
89 .Pq Fa fs_file ,
90 describes the mount point for the file system.
91 For swap partitions, this field should be specified as
92 .Dq none .
93 .Pp
94 The third field,
95 .Pq Fa fs_vfstype ,
96 describes the type of the file system.
97 The system can support various file system types.
98 Only the root,
99 .Pa /usr ,
100 and
101 .Pa /tmp
102 file systems need be statically
103 compiled into the kernel;
104 everything else will be automatically loaded at mount
105 time.
106 (Exception: the UFS family - FFS, MFS, and LFS cannot
107 currently be demand-loaded.)  Some people still prefer to statically
108 compile other file systems as well.
109 .Pp
110 The most common file system types are:
111 .Bl -tag -width ".Em HAMMER2" -offset indent
112 .It Em HAMMER
113 a local
114 .Xr HAMMER 5
115 file system
116 .It Em HAMMER2
117 a local HAMMER2 file system
118 .It Em ufs
119 a local
120 .Xr ffs 5
121 .Ux
122 file system
123 .It Em mfs
124 a local memory-based
125 .Ux
126 file system
127 .It Em nfs
128 a Sun Microsystems compatible
129 .Dq "Network File System"
130 .It Em swap
131 a disk partition to be used for swapping
132 .It Em msdos
133 a local
134 .Xr msdos 5
135 DOS compatible file system
136 .It Em cd9660
137 a local CD-ROM file system (as per ISO 9660)
138 .\" maybe also say Rock Ridge extensions are handled ?
139 .It Em procfs
140 a file system for accessing process data
141 .El
142 .Pp
143 The fourth field,
144 .Pq Fa fs_mntops ,
145 describes the mount options associated with the file system.
146 It is formatted as a comma separated list of options.
147 It contains at least the type of mount (see
148 .Fa fs_type
149 below) plus any additional options
150 appropriate to the file system type.
151 See the options flag
152 .Pq Fl o
153 in the
154 .Xr mount 8
155 page and the file system specific page, such as
156 .Xr mount_nfs 8 ,
157 for additional options that may be specified.
158 .Pp
159 If the options ``userquota'' and/or ``groupquota'' are specified,
160 the file system is automatically processed by the
161 .Xr quotacheck 8
162 command, and user and/or group disk quotas are enabled with
163 .Xr quotaon 8 .
164 By default,
165 file system quotas are maintained in files named
166 .Pa quota.user
167 and
168 .Pa quota.group
169 which are located at the root of the associated file system.
170 These defaults may be overridden by putting an equal sign
171 and an alternative absolute pathname following the quota option.
172 Thus, if the user quota file for
173 .Pa /tmp
174 is stored in
175 .Pa /var/quotas/tmp.user ,
176 this location can be specified as:
177 .Bd -literal -offset indent
178 userquota=/var/quotas/tmp.user
179 .Ed
180 .Pp
181 If the option ``noauto'' is specified, the file system will not be automatically
182 mounted at system startup.
183 This is recommended for all remote file systems other than NFS,
184 since only NFS mounts are delayed until after network initialization
185 by the
186 .Xr rc 8
187 startup scripts.
188 .Pp
189 Swap partitions may specify the option ``crypt'' to automatically encrypt
190 the swap partition with a random key.
191 Note that you will not be able to
192 recover any kernel core dumps if you use this option.
193 .Pp
194 The type of the mount is extracted from the
195 .Fa fs_mntops
196 field and stored separately in the
197 .Fa fs_type
198 field (it is not deleted from the
199 .Fa fs_mntops
200 field).
201 If
202 .Fa fs_type
203 is ``rw'' or ``ro'' then the file system whose name is given in the
204 .Fa fs_file
205 field is normally mounted read-write or read-only on the
206 specified special file.
207 If
208 .Fa fs_type
209 is ``sw'' then the special file is made available as a piece of swap
210 space by the
211 .Xr swapon 8
212 command at the end of the system reboot procedure.
213 The fields other than
214 .Fa fs_spec
215 and
216 .Fa fs_type
217 are unused.
218 If
219 .Fa fs_type
220 is specified as ``xx'' the entry is ignored.
221 This is useful to show disk partitions which are currently unused.
222 .Pp
223 The fifth field,
224 .Pq Fa fs_freq ,
225 is used for these file systems by the
226 .Xr dump 8
227 command to determine which file systems need to be dumped.
228 If the fifth field is not present, a value of zero is returned and
229 .Nm dump
230 will assume that the file system does not need to be dumped.
231 .Pp
232 The sixth field,
233 .Pq Fa fs_passno ,
234 is used by the
235 .Xr fsck 8
236 program to determine the order in which file system checks are done
237 at reboot time.
238 The root file system should be specified with a
239 .Fa fs_passno
240 of 1, and other file systems should have a
241 .Fa fs_passno
242 of 2.
243 File systems within a drive will be checked sequentially,
244 but file systems on different drives will be checked at the
245 same time to utilize parallelism available in the hardware.
246 If the sixth field is not present or is zero,
247 a value of zero is returned and
248 .Xr fsck 8
249 will assume that the file system does not need to be checked.
250 .Bd -literal
251 #define FSTAB_RW        "rw"    /* read/write device */
252 #define FSTAB_RQ        "rq"    /* read/write with quotas */
253 #define FSTAB_RO        "ro"    /* read-only device */
254 #define FSTAB_SW        "sw"    /* swap device */
255 #define FSTAB_XX        "xx"    /* ignore totally */
256
257 struct fstab {
258         char    *fs_spec;       /* block special device name */
259         char    *fs_file;       /* file system path prefix */
260         char    *fs_vfstype;    /* File system type, ufs, nfs */
261         char    *fs_mntops;     /* Mount options ala -o */
262         char    *fs_type;       /* FSTAB_* from fs_mntops */
263         int     fs_freq;        /* dump frequency, in days */
264         int     fs_passno;      /* pass number on parallel fsck */
265 };
266 .Ed
267 .Pp
268 The proper way to read records from
269 .Nm
270 is to use the routines
271 .Xr getfsent 3 ,
272 .Xr getfsspec 3 ,
273 .Xr getfstype 3 ,
274 and
275 .Xr getfsfile 3 .
276 .Sh FILES
277 .Bl -tag -width /etc/fstab -compact
278 .It Pa /etc/fstab
279 The file
280 .Nm
281 resides in
282 .Pa /etc .
283 .El
284 .Sh SEE ALSO
285 .Xr getfsent 3 ,
286 .Xr getvfsbyname 3 ,
287 .Xr HAMMER 5 ,
288 .\".Xr HAMMER2 5 ,
289 .Xr dump 8 ,
290 .Xr fsck 8 ,
291 .Xr mount 8 ,
292 .Xr quotacheck 8 ,
293 .Xr quotaon 8 ,
294 .Xr swapon 8 ,
295 .Xr umount 8
296 .Sh HISTORY
297 The
298 .Nm
299 file format appeared in
300 .Bx 4.0 .