Commit | Line | Data |
---|---|---|
517c4acb KB |
1 | .\" Copyright (c) 1980, 1989, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
40eeacc1 | 3 | .\" |
eadcc84a | 4 | .\" %sccs.include.redist.roff% |
1e24342d | 5 | .\" |
517c4acb | 6 | .\" @(#)fstab.5 8.1 (Berkeley) %G% |
40eeacc1 | 7 | .\" |
eadcc84a CL |
8 | .Dd |
9 | .Dt FSTAB 5 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm fstab | |
13 | .Nd static information about the filesystems | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <fstab.h> | |
16 | .Sh DESCRIPTION | |
40eeacc1 | 17 | The file |
eadcc84a | 18 | .Nm fstab |
40eeacc1 KM |
19 | contains descriptive information about the various file |
20 | systems. | |
eadcc84a | 21 | .Nm fstab |
1e24342d | 22 | is only read by programs, and not written; |
40eeacc1 KM |
23 | it is the duty of the system administrator to properly create |
24 | and maintain this file. | |
0370342b | 25 | Each filesystem is described on a separate line; |
1e24342d | 26 | fields on each line are separated by tabs or spaces. |
40eeacc1 | 27 | The order of records in |
eadcc84a | 28 | .Nm fstab |
baae7f16 | 29 | is important because |
eadcc84a CL |
30 | .Xr fsck 8 , |
31 | .Xr mount 8 , | |
40eeacc1 | 32 | and |
eadcc84a | 33 | .Xr umount 8 |
40eeacc1 | 34 | sequentially iterate through |
eadcc84a | 35 | .Nm fstab |
40eeacc1 | 36 | doing their thing. |
eadcc84a CL |
37 | .Pp |
38 | The first field, | |
39 | .Pq Fa fs_spec , | |
1e24342d | 40 | describes the block special device or |
0370342b KM |
41 | remote filesystem to be mounted. |
42 | For filesystems of type | |
eadcc84a | 43 | .Em ufs , |
1e24342d | 44 | the special file name is the block special file name, |
40eeacc1 KM |
45 | and not the character special file name. |
46 | If a program needs the character special file name, | |
47 | the program must create it by appending a ``r'' after the | |
48 | last ``/'' in the special file name. | |
eadcc84a CL |
49 | .Pp |
50 | The second field, | |
51 | .Pq Fa fs_file , | |
0370342b | 52 | describes the mount point for the filesystem. |
1e24342d | 53 | For swap partitions, this field should be specified as ``none''. |
eadcc84a CL |
54 | .Pp |
55 | The third field, | |
56 | .Pq Fa fs_vfstype , | |
0370342b KM |
57 | describes the type of the filesystem. |
58 | The system currently supports four types of filesystems: | |
eadcc84a CL |
59 | .Bl -tag -width indent -offset indent |
60 | .It Em ufs | |
61 | a local | |
62 | .Tn UNIX | |
63 | filesystem | |
64 | .It Em mfs | |
65 | a local memory-based | |
66 | .Tn UNIX | |
67 | filesystem | |
68 | .It Em nfs | |
0370342b | 69 | a Sun Microsystems compatible ``Network File System'' |
eadcc84a | 70 | .It Em swap |
1e24342d | 71 | a disk partition to be used for swapping |
eadcc84a CL |
72 | .El |
73 | .Pp | |
74 | The fourth field, | |
75 | .Pq Fa fs_mntops , | |
0370342b | 76 | describes the mount options associated with the filesystem. |
1e24342d KM |
77 | It is formatted as a comma separated list of options. |
78 | It contains at least the type of mount (see | |
eadcc84a | 79 | .Fa fs_type |
1e24342d | 80 | below) plus any additional options |
0370342b | 81 | appropriate to the filesystem type. |
eadcc84a | 82 | .Pp |
0370342b KM |
83 | If the options ``userquota'' and/or ``groupquota'' are specified, |
84 | the filesystem is automatically processed by the | |
eadcc84a | 85 | .Xr quotacheck 8 |
0370342b | 86 | command, and user and/or group disk quotas are enabled with |
eadcc84a | 87 | .Xr quotaon 8 . |
0370342b KM |
88 | By default, |
89 | filesystem quotas are maintained in files named | |
eadcc84a | 90 | .Pa quota.user |
0370342b | 91 | and |
eadcc84a | 92 | .Pa quota.group |
0370342b KM |
93 | which are located at the root of the associated filesystem. |
94 | These defaults may be overridden by putting an equal sign | |
95 | and an alternative absolute pathname following the quota option. | |
eadcc84a CL |
96 | Thus, if the user quota file for |
97 | .Pa /tmp | |
98 | is stored in | |
99 | .Pa /var/quotas/tmp.user , | |
0370342b | 100 | this location can be specified as: |
eadcc84a CL |
101 | .Bd -literal -offset indent |
102 | userquota=/var/quotas/tmp.user | |
103 | .Ed | |
104 | .Pp | |
1e24342d | 105 | The type of the mount is extracted from the |
eadcc84a | 106 | .Fa fs_mntops |
1e24342d | 107 | field and stored separately in the |
eadcc84a | 108 | .Fa fs_type |
1e24342d | 109 | field (it is not deleted from the |
eadcc84a | 110 | .Fa fs_mntops |
1e24342d | 111 | field). |
40eeacc1 | 112 | If |
eadcc84a | 113 | .Fa fs_type |
0370342b | 114 | is ``rw'' or ``ro'' then the filesystem whose name is given in the |
eadcc84a | 115 | .Fa fs_file |
baae7f16 | 116 | field is normally mounted read-write or read-only on the |
0370342b | 117 | specified special file. |
40eeacc1 | 118 | If |
eadcc84a | 119 | .Fa fs_type |
baae7f16 | 120 | is ``sw'' then the special file is made available as a piece of swap |
40eeacc1 | 121 | space by the |
eadcc84a | 122 | .Xr swapon 8 |
40eeacc1 KM |
123 | command at the end of the system reboot procedure. |
124 | The fields other than | |
eadcc84a | 125 | .Fa fs_spec |
40eeacc1 | 126 | and |
eadcc84a | 127 | .Fa fs_type |
1e24342d | 128 | are unused. |
baae7f16 | 129 | If |
eadcc84a | 130 | .Fa fs_type |
baae7f16 | 131 | is specified as ``xx'' the entry is ignored. |
1e24342d | 132 | This is useful to show disk partitions which are currently unused. |
eadcc84a CL |
133 | .Pp |
134 | The fifth field, | |
135 | .Pq Fa fs_freq , | |
0370342b | 136 | is used for these filesystems by the |
eadcc84a | 137 | .Xr dump 8 |
0370342b | 138 | command to determine which filesystems need to be dumped. |
1e24342d | 139 | If the fifth field is not present, a value of zero is returned and |
eadcc84a | 140 | .Xr dump |
0370342b | 141 | will assume that the filesystem does not need to be dumped. |
eadcc84a CL |
142 | .Pp |
143 | The sixth field, | |
144 | .Pq Fa fs_passno , | |
1e24342d | 145 | is used by the |
eadcc84a | 146 | .Xr fsck 8 |
0370342b | 147 | program to determine the order in which filesystem checks are done |
1e24342d | 148 | at reboot time. |
0370342b | 149 | The root filesystem should be specified with a |
eadcc84a | 150 | .Fa fs_passno |
0370342b | 151 | of 1, and other filesystems should have a |
eadcc84a | 152 | .Fa fs_passno |
0370342b KM |
153 | of 2. |
154 | Filesystems within a drive will be checked sequentially, | |
155 | but filesystems on different drives will be checked at the | |
156 | same time to utilize parallelism available in the hardware. | |
157 | If the sixth field is not present or zero, | |
158 | a value of zero is returned and | |
eadcc84a | 159 | .Xr fsck |
0370342b | 160 | will assume that the filesystem does not need to be checked. |
eadcc84a | 161 | .Bd -literal |
baae7f16 KM |
162 | #define FSTAB_RW "rw" /* read-write device */ |
163 | #define FSTAB_RO "ro" /* read-only device */ | |
baae7f16 KM |
164 | #define FSTAB_SW "sw" /* swap device */ |
165 | #define FSTAB_XX "xx" /* ignore totally */ | |
eadcc84a | 166 | |
40eeacc1 | 167 | struct fstab { |
baae7f16 | 168 | char *fs_spec; /* block special device name */ |
0370342b KM |
169 | char *fs_file; /* filesystem path prefix */ |
170 | char *fs_vfstype; /* type of filesystem */ | |
1e24342d KM |
171 | char *fs_mntops; /* comma separated mount options */ |
172 | char *fs_type; /* rw, ro, sw, or xx */ | |
173 | int fs_freq; /* dump frequency, in days */ | |
174 | int fs_passno; /* pass number on parallel dump */ | |
40eeacc1 | 175 | }; |
eadcc84a CL |
176 | .Ed |
177 | .Pp | |
40eeacc1 | 178 | The proper way to read records from |
eadcc84a CL |
179 | .Pa fstab |
180 | is to use the routines | |
181 | .Xr getfsent 3 , | |
182 | .Xr getfsspec 3 , | |
183 | .Xr getfstype 3 , | |
184 | and | |
185 | .Xr getfsfile 3 . | |
186 | .Sh FILES | |
187 | .Bl -tag -width /etc/fstab -compact | |
188 | .It Pa /etc/fstab | |
189 | The file | |
190 | .Nm fstab | |
191 | resides in | |
192 | .Pa /etc . | |
193 | .El | |
194 | .Sh SEE ALSO | |
195 | .Xr getfsent 3 | |
196 | .Sh HISTORY | |
197 | The | |
198 | .Nm | |
199 | file format appeared in | |
200 | .Bx 4.0 . |