sync
[bitrig.git] / share / man / man5 / fstab.5
blobbeda95a942aa8b94b7ca07e92fd8f9fa5049a9b6
1 .\"     $OpenBSD: fstab.5,v 1.45 2011/04/17 20:17:12 krw Exp $
2 .\"     $NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $
3 .\"
4 .\" Copyright (c) 1980, 1989, 1991, 1993
5 .\"     The Regents of the University of California.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)fstab.5     8.1 (Berkeley) 6/5/93
32 .\"
33 .Dd $Mdocdate: April 17 2011 $
34 .Dt FSTAB 5
35 .Os
36 .Sh NAME
37 .Nm fstab
38 .Nd static information about the filesystems
39 .Sh SYNOPSIS
40 .Fd #include <fstab.h>
41 .Sh DESCRIPTION
42 The
43 .Nm
44 file contains descriptive information about the various file 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 filesystem is described on a separate line;
50 fields on each line are separated by tabs or spaces.
51 Lines beginning with the
52 .Sq #
53 character are comments and are ignored.
54 The order of records in
55 .Nm
56 is important because
57 .Xr fsck 8
58 and
59 .Xr mount 8
60 sequentially iterate through
61 .Nm
62 doing their thing.
63 .Pp
64 A line has the following format:
65 .Bd -literal -offset indent
66 fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
67 .Ed
68 .Pp
69 The first field,
70 .Fa fs_spec ,
71 describes the block special device or remote filesystem to be mounted.
72 A block special device may be specified by pathname
73 or by
74 .Xr disklabel 8
75 UID (DUID).
76 For filesystems of type MFS
77 the special file name is typically that of the primary swap area;
78 if the keyword
79 .Dq swap
80 is used instead of a special file name,
81 default configuration parameters are used.
82 If a program needs the character special file name,
83 the program must create it by appending an
84 .Sq r
85 after the last
86 .Sq /
87 in the special file name.
88 .Pp
89 The second field,
90 .Fa fs_file ,
91 describes the mount point for the filesystem.
92 For swap partitions, this field should be specified as
93 .Dq none .
94 .Pp
95 The third field,
96 .Fa fs_vfstype ,
97 describes the type of the filesystem.
98 The system currently supports the following types of filesystems:
99 .Pp
100 .Bl -tag -width indent -offset indent -compact
101 .It cd9660
102 An ISO 9660 CD-ROM filesystem.
103 .It ext2fs
104 A local Linux compatible ext2fs
105 filesystem.
106 .It ffs
107 A local
109 filesystem.
110 .It mfs
111 A local memory-based
113 filesystem.
114 .It msdos
116 .Tn MS-DOS
117 FAT filesystem.
118 .It nfs
119 A Sun Microsystems compatible Network File System.
120 .It ntfs
121 An NTFS filesystem.
122 .It procfs
123 A local filesystem containing process information.
124 .It swap
125 A disk partition to be used for swapping.
126 .It udf
127 A UDF filesystem.
128 .It vnd
129 A VND image file.
130 .It tmpfs
131 A local, efficient memory-based file system.
134 The fourth field,
135 .Fa fs_mntops ,
136 describes the mount options associated with the filesystem.
137 It is formatted as a comma separated list of options.
138 It contains at least the type of mount (see
139 .Fa fs_type
140 below) plus any additional options appropriate to the filesystem type.
142 The option
143 .Dq auto
144 can be used in the
145 .Dq noauto
146 form to cause
147 a file system not to be mounted automatically (with
148 .Ic mount -A
150 .Ic mount -a ,
151 or at system boot time).
153 If the options
154 .Dq userquota
155 and/or
156 .Dq groupquota
157 are specified, the filesystem is automatically processed by the
158 .Xr quotacheck 8
159 command, and user and/or group disk quotas are enabled with
160 .Xr quotaon 8 .
161 By default, filesystem quotas are maintained in files named
162 .Pa quota.user
164 .Pa quota.group
165 which are located at the root of the associated filesystem.
166 These defaults may be overridden by putting an equal sign
167 and an alternative absolute pathname following the quota option.
168 Thus, if the user quota file for
169 .Pa /tmp
170 is stored in
171 .Pa /var/quotas/tmp.user ,
172 this location can be specified as:
173 .Bd -literal -offset indent
174 userquota=/var/quotas/tmp.user
177 The type of the mount is extracted from the first parameter of the
178 .Fa fs_mntops
179 field and stored separately in the
180 .Fa fs_type
181 field (it is not deleted from the
182 .Fa fs_mntops
183 field).
185 .Fa fs_type
187 .Dq rw ,
188 .Dq rq ,
190 .Dq ro
191 then the filesystem whose name is given in the
192 .Fa fs_file
193 field is normally mounted read-write or read-only on the
194 specified special file.
196 .Fa fs_type
198 .Dq sw
199 then the special file is made available as a piece of swap space by the
200 .Xr swapon 8
201 command at the end of the system reboot procedure.
202 The fields other than
203 .Fa fs_spec
205 .Fa fs_type
206 are unused.
208 .Fa fs_type
209 is specified as
210 .Dq xx
211 the entry is ignored.
212 This is useful to show disk partitions which are currently unused.
214 The fifth field,
215 .Fa fs_freq ,
216 is used by the
217 .Fl W
219 .Fl w
220 options of
221 .Xr dump 8
222 to recommend which filesystems should be backed up.
223 The value specifies the number of days
224 after which a dump is regarded as being old;
225 if it is not present, a value of zero is returned and
226 .Xr dump 8
227 will assume that the filesystem does not need to be dumped.
229 The sixth field,
230 .Fa fs_passno ,
231 is used by the
232 .Xr fsck 8
233 program to determine the order in which filesystem checks are done
234 at reboot time.
235 The root filesystem should be specified with a
236 .Fa fs_passno
237 of 1, and other filesystems should have a
238 .Fa fs_passno
239 of 2.
240 Filesystems within a drive will be checked sequentially,
241 but filesystems on different drives will be checked at the
242 same time to utilize parallelism available in the hardware.
243 If the sixth field is not present or is zero,
244 a value of zero is returned and
245 .Xr fsck 8
246 will assume that the filesystem does not need to be checked.
247 .Bd -literal
248 #define FSTAB_RW        "rw"    /* read/write device */
249 #define FSTAB_RQ        "rq"    /* read/write with quotas *
250 #define FSTAB_RO        "ro"    /* read-only device */
251 #define FSTAB_SW        "sw"    /* swap device */
252 #define FSTAB_XX        "xx"    /* ignore totally */
254 struct fstab {
255         char    *fs_spec;       /* block special device name */
256         char    *fs_file;       /* filesystem path prefix */
257         char    *fs_vfstype;    /* type of filesystem */
258         char    *fs_mntops;     /* comma separated mount options */
259         char    *fs_type;       /* rw, rq, ro, sw, or xx */
260         int     fs_freq;        /* dump frequency, in days */
261         int     fs_passno;      /* pass number on parallel fsck */
265 The proper way to read records from
266 .Pa fstab
267 is to use the routines
268 .Xr getfsent 3 ,
269 .Xr getfsspec 3 ,
271 .Xr getfsfile 3 .
272 .Sh FILES
273 .Bl -tag -width /etc/fstab -compact
274 .It Pa /etc/fstab
276 .Sh EXAMPLES
277 Here is a sample
278 .Pa /etc/fstab
279 file:
280 .Bd -literal -offset indent
281 /dev/sd0b none swap sw
282 /dev/sd1b none swap sw
283 /dev/sd0a / ffs rw 1 1
284 /dev/sd0e /var ffs rw,nodev,nosuid 1 2
285 #/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2
286 swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
287 /dev/sd0g /usr ffs rw,nodev 1 2
288 /dev/sd0h /usr/local ffs rw,nodev 1 2
289 /dev/sd0i /home ffs rw,nodev,nosuid 1 2
290 /dev/sd0j /usr/src ffs rw,nodev,nosuid,softdep 1 2
291 /dev/cd0a /cdrom cd9660 ro,noauto 0 0
292 5b27c2761a9b0b06.i /mnt/key msdos rw,noauto 0 0
293 server:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0
295 .Sh SEE ALSO
296 .Xr quota 1 ,
297 .Xr getfsent 3 ,
298 .Xr fsck 8 ,
299 .Xr mount 8 ,
300 .Xr quotacheck 8 ,
301 .Xr quotaon 8
302 .Sh HISTORY
305 file format appeared in
306 .Bx 4.0 .