]> git.cameronkatri.com Git - apple_cmds.git/blob - diskdev_cmds/mount.tproj/fstab.5
setup.sh: Use iOS ~12 XNU version
[apple_cmds.git] / diskdev_cmds / mount.tproj / fstab.5
1 .\" $NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $
2 .\"
3 .\" Copyright (c) 1980, 1989, 1991, 1993, 2002
4 .\" The Regents of the University of California. All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed by the University of
17 .\" California, Berkeley and its contributors.
18 .\" 4. Neither the name of the University nor the names of its contributors
19 .\" may be used to endorse or promote products derived from this software
20 .\" without specific prior written permission.
21 .\"
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\" @(#)fstab.5 8.1 (Berkeley) 6/5/93
35 .\"
36 .Dd March 28, 2002
37 .Dt FSTAB 5
38 .Os Darwin
39 .Sh NAME
40 .Nm fstab
41 .Nd static information about the filesystems
42 .Sh SYNOPSIS
43 .Fd #include <fstab.h>
44 .Sh DESCRIPTION
45 The file
46 .Nm fstab
47 contains descriptive information about the various file
48 systems.
49 .Nm fstab
50 is only read by programs, and not written;
51 it is the duty of the system administrator to properly create
52 and maintain this file, using the
53 .Xr vifs 8
54 command.
55 Each filesystem is described on a separate line;
56 fields on each line are separated by tabs or spaces.
57 The order of records in
58 .Nm fstab
59 is important because
60 .Xr diskarbitrationd 8 ,
61 .Xr fsck 8 ,
62 .Xr mount 8 ,
63 and
64 .Xr umount 8
65 sequentially iterate through
66 .Nm fstab
67 doing their thing.
68 .Pp
69 The first field,
70 .Pq Fa fs_spec ,
71 describes the block special device, the local filesystem, or
72 the remote filesystem to be mounted. The
73 .Xr diskarbitrationd
74 program supports the identification of a local filesystem uniquely by its
75 UUID or by its volume name, irrespective of hardware configuration and of
76 hardware parallelism, using the constructs ``UUID'' and ``LABEL''.
77 For APFS volumes, this field should never be the block special device as it is
78 not constant. Only the constructs ``UUID'' and ``LABEL'' should be used.
79 .Pp
80 The second field,
81 .Pq Fa fs_file ,
82 describes the mount point for the filesystem.
83 For swap partitions, this field should be specified as ``none''.
84 .Pp
85 The third field,
86 .Pq Fa fs_vfstype ,
87 describes the type of the filesystem.
88 The system currently supports different filesystem types, including the following:
89 .Bl -tag -width indent -offset indent
90 .It Em apfs
91 APFS is the Mac OS X default filesystem since version 10.13 (High Sierra).
92 .It Em hfs
93 HFS+ is the previous Mac OS X default filesystem.
94 .It Em nfs
95 a Sun Microsystems compatible ``Network File System''
96 .It Em msdos
97 a DOS compatible filesystem
98 .It Em cd9660
99 a CD-ROM filesystem (as per ISO 9660)
100 .It Em fdesc
101 an implementation of /dev/fd
102 .It Em union
103 a translucent filesystem
104 .El
105 .Pp
106 The fourth field,
107 .Pq Fa fs_mntops ,
108 describes the mount options associated with the filesystem.
109 It is formatted as a comma separated list of options.
110 It contains at least the type of mount (see
111 .Fa fs_type
112 below) plus any additional options
113 appropriate to the filesystem type.
114 .Pp
115 The option ``auto'' can be used in the ``noauto'' form to cause
116 a file system not to be mounted automatically (with ``mount -a'',
117 or system boot time).
118 .Pp
119 The type of the mount is extracted from the
120 .Fa fs_mntops
121 field and stored separately in the
122 .Fa fs_type
123 field (it is not deleted from the
124 .Fa fs_mntops
125 field).
126 If
127 .Fa fs_type
128 is ``rw'' or ``ro'' then the filesystem whose name is given in the
129 .Fa fs_file
130 field is normally mounted read-write or read-only on the
131 specified special file.
132 If
133 .Fa fs_type
134 is ``sw'' then the special file is made available as a piece of swap
135 space by the
136 .Xr swapon 8
137 command at the end of the system reboot procedure.
138 The fields other than
139 .Fa fs_spec
140 and
141 .Fa fs_type
142 are unused.
143 If
144 .Fa fs_type
145 is specified as ``xx'' the entry is ignored.
146 This is useful to show disk partitions which are currently unused.
147 .Pp
148 The fifth field,
149 .Pq Fa fs_freq ,
150 is used for these filesystems by the
151 .Xr dump 8
152 command to determine which filesystems need to be dumped.
153 If the fifth field is not present, a value of zero is returned and
154 .Xr dump
155 will assume that the filesystem does not need to be dumped.
156 .Pp
157 The sixth field,
158 .Pq Fa fs_passno ,
159 is used by the
160 .Xr fsck 8
161 program to determine the order in which filesystem checks are done
162 at reboot time.
163 The root filesystem should be specified with a
164 .Fa fs_passno
165 of 1, and other filesystems should have a
166 .Fa fs_passno
167 of 2.
168 Filesystems within a drive will be checked sequentially,
169 but filesystems on different drives will be checked at the
170 same time to utilize parallelism available in the hardware.
171 If the sixth field is not present or zero,
172 a value of zero is returned and
173 .Xr fsck
174 will assume that the filesystem does not need to be checked.
175 .Bd -literal
176 #define FSTAB_RW "rw" /* read-write device */
177 #define FSTAB_RO "ro" /* read-only device */
178 #define FSTAB_SW "sw" /* swap device */
179 #define FSTAB_XX "xx" /* ignore totally */
180
181 struct fstab {
182 char *fs_spec; /* block special device name */
183 char *fs_file; /* filesystem path prefix */
184 char *fs_vfstype; /* type of filesystem */
185 char *fs_mntops; /* comma separated mount options */
186 char *fs_type; /* rw, ro, sw, or xx */
187 int fs_freq; /* dump frequency, in days */
188 int fs_passno; /* pass number on parallel fsck */
189 };
190 .Ed
191 .Pp
192 The proper way to read records from
193 .Pa fstab
194 is to use the routines
195 .Xr getfsent 3 ,
196 .Xr getfsspec 3 ,
197 .Xr getfstype 3 ,
198 and
199 .Xr getfsfile 3 .
200 .Sh EXAMPLES
201 .Bd -literal
202 UUID=2A1B02AD-467D-403A-8CCD-B87E50AD3DA2 none apfs rw
203 UUID=DF000C7E-AE0C-3B15-B730-DFD2EF15CB91 /export apfs ro
204 UUID=FAB060E9-79F7-33FF-BE85-E1D3ABD3EDEA none hfs rw,noauto
205 LABEL=The\\040Volume\\040Name\\040Is\\040This none msdos ro
206 .Ed
207 .Sh FILES
208 .Bl -tag -width /etc/fstab -compact
209 .It Pa /etc/fstab
210 The file
211 .Nm fstab
212 resides in
213 .Pa /etc .
214 .El
215 .Sh SEE ALSO
216 .Xr getfsent 3 ,
217 .Xr diskarbitrationd 8
218 .Sh HISTORY
219 The
220 .Nm
221 file format appeared in
222 .Bx 4.0 .