Initial import from FreeBSD RELENG_4:
[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. 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: src/share/man/man5/fstab.5,v 1.11.2.8 2003/02/10 12:21:08 des Exp $
34 .\"
35 .Dd June 5, 1993
36 .Dt FSTAB 5
37 .Os
38 .Sh NAME
39 .Nm fstab
40 .Nd static information about the filesystems
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 filesystem 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 block special device or
68 remote filesystem to be mounted.
69 For filesystems of type
70 .Em ufs ,
71 the special file name is the block special file name,
72 and not the character special file name.
73 If a program needs the character special file name,
74 the program must create it by appending a ``r'' after the
75 last ``/'' in the special file name.
76 .Pp
77 The second field,
78 .Pq Fa fs_file ,
79 describes the mount point for the filesystem.
80 For swap partitions, this field should be specified as ``none''.
81 .Pp
82 The third field,
83 .Pq Fa fs_vfstype ,
84 describes the type of the filesystem.
85 The system can support various filesystem types.
86 Only the root, /usr, and /tmp filesystems need be statically
87 compiled into the kernel;
88 everything else will be automatically loaded at mount
89 time.  (Exception: the UFS family - FFS, MFS, and LFS cannot
90 currently be demand-loaded.)  Some people still prefer to statically
91 compile other filesystems as well.
92 .Bl -tag -width indent -offset indent
93 .It Em ufs
94 a local
95 .Tn UNIX
96 filesystem
97 .It Em mfs
98 a local memory-based
99 .Tn UNIX
100 filesystem
101 .It Em nfs
102 a Sun Microsystems compatible ``Network File System''
103 .It Em swap
104 a disk partition to be used for swapping
105 .It Em msdos
106 a DOS compatible filesystem
107 .It Em cd9660
108 a CD-ROM filesystem (as per ISO 9660)
109 .\" maybe also say Rock Ridge extensions are handled ?
110 .It Em procfs
111 a file system for accessing process data
112 .El
113 .Pp
114 The fourth field,
115 .Pq Fa fs_mntops ,
116 describes the mount options associated with the filesystem.
117 It is formatted as a comma separated list of options.
118 It contains at least the type of mount (see
119 .Fa fs_type
120 below) plus any additional options
121 appropriate to the filesystem type.  See the options flag
122 .Pq Fl o
123 in the
124 .Xr mount 8
125 page and the filesystem specific page, such as
126 .Xr mount_nfs 8 ,
127 for additional options that may be specified.
128 .Pp
129 If the options ``userquota'' and/or ``groupquota'' are specified,
130 the filesystem 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 filesystem 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 filesystem.
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 filesystem will not be automatically
152 mounted at system startup.
153 This is recommended for all remote filesystems other than NFS,
154 since only NFS mounts are delayed until after network initialization
155 by the
156 .Xr rc
157 startup scripts.
158 .Pp
159 The type of the mount is extracted from the
160 .Fa fs_mntops
161 field and stored separately in the
162 .Fa fs_type
163 field (it is not deleted from the
164 .Fa fs_mntops
165 field).
166 If
167 .Fa fs_type
168 is ``rw'' or ``ro'' then the filesystem whose name is given in the
169 .Fa fs_file
170 field is normally mounted read-write or read-only on the
171 specified special file.
172 If
173 .Fa fs_type
174 is ``sw'' then the special file is made available as a piece of swap
175 space by the
176 .Xr swapon 8
177 command at the end of the system reboot procedure.
178 The fields other than
179 .Fa fs_spec
180 and
181 .Fa fs_type
182 are unused.
183 If
184 .Fa fs_type
185 is specified as ``xx'' the entry is ignored.
186 This is useful to show disk partitions which are currently unused.
187 .Pp
188 The fifth field,
189 .Pq Fa fs_freq ,
190 is used for these filesystems by the
191 .Xr dump 8
192 command to determine which filesystems need to be dumped.
193 If the fifth field is not present, a value of zero is returned and
194 .Nm dump
195 will assume that the filesystem does not need to be dumped.
196 .Pp
197 The sixth field,
198 .Pq Fa fs_passno ,
199 is used by the
200 .Xr fsck 8
201 program to determine the order in which filesystem checks are done
202 at reboot time.
203 The root filesystem should be specified with a
204 .Fa fs_passno
205 of 1, and other filesystems should have a
206 .Fa fs_passno
207 of 2.
208 Filesystems within a drive will be checked sequentially,
209 but filesystems on different drives will be checked at the
210 same time to utilize parallelism available in the hardware.
211 If the sixth field is not present or is zero,
212 a value of zero is returned and
213 .Xr fsck 8
214 will assume that the filesystem does not need to be checked.
215 .Bd -literal
216 #define FSTAB_RW        "rw"    /* read/write device */
217 #define FSTAB_RQ        "rq"    /* read/write with quotas */
218 #define FSTAB_RO        "ro"    /* read-only device */
219 #define FSTAB_SW        "sw"    /* swap device */
220 #define FSTAB_XX        "xx"    /* ignore totally */
221
222 struct fstab {
223         char    *fs_spec;       /* block special device name */
224         char    *fs_file;       /* filesystem path prefix */
225         char    *fs_vfstype;    /* File system type, ufs, nfs */
226         char    *fs_mntops;     /* Mount options ala -o */
227         char    *fs_type;       /* FSTAB_* from fs_mntops */
228         int     fs_freq;        /* dump frequency, in days */
229         int     fs_passno;      /* pass number on parallel fsck */
230 };
231 .Ed
232 .Pp
233 The proper way to read records from
234 .Pa fstab
235 is to use the routines
236 .Xr getfsent 3 ,
237 .Xr getfsspec 3 ,
238 .Xr getfstype 3 ,
239 and
240 .Xr getfsfile 3 .
241 .Sh FILES
242 .Bl -tag -width /etc/fstab -compact
243 .It Pa /etc/fstab
244 The file
245 .Nm
246 resides in
247 .Pa /etc .
248 .El
249 .Sh SEE ALSO
250 .Xr getfsent 3 ,
251 .Xr getvfsbyname 3 ,
252 .Xr dump 8 ,
253 .Xr fsck 8 ,
254 .Xr mount 8 ,
255 .Xr quotacheck 8 ,
256 .Xr quotaon 8 ,
257 .Xr swapon 8 ,
258 .Xr umount 8
259 .Sh HISTORY
260 The
261 .Nm
262 file format appeared in
263 .Bx 4.0 .