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