1*e50e3288Sjob.\" $OpenBSD: fstab.5,v 1.55 2023/07/07 13:21:28 job Exp $ 2cf70cebbSderaadt.\" $NetBSD: fstab.5,v 1.5.2.1 1995/11/16 20:11:11 pk Exp $ 3df930be7Sderaadt.\" 4df930be7Sderaadt.\" Copyright (c) 1980, 1989, 1991, 1993 5df930be7Sderaadt.\" The Regents of the University of California. All rights reserved. 6df930be7Sderaadt.\" 7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 8df930be7Sderaadt.\" modification, are permitted provided that the following conditions 9df930be7Sderaadt.\" are met: 10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 11df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 13df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 14df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 1529295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors 16df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 17df930be7Sderaadt.\" without specific prior written permission. 18df930be7Sderaadt.\" 19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29df930be7Sderaadt.\" SUCH DAMAGE. 30df930be7Sderaadt.\" 31df930be7Sderaadt.\" @(#)fstab.5 8.1 (Berkeley) 6/5/93 32df930be7Sderaadt.\" 33*e50e3288Sjob.Dd $Mdocdate: July 7 2023 $ 34df930be7Sderaadt.Dt FSTAB 5 35fc8533a3Saaron.Os 36df930be7Sderaadt.Sh NAME 37df930be7Sderaadt.Nm fstab 38df930be7Sderaadt.Nd static information about the filesystems 39df930be7Sderaadt.Sh SYNOPSIS 40ec5cd23eSschwarze.In fstab.h 41df930be7Sderaadt.Sh DESCRIPTION 42431305c8SaaronThe 43431305c8Saaron.Nm 44431305c8Saaronfile contains descriptive information about the various file systems. 45431305c8Saaron.Nm 46df930be7Sderaadtis only read by programs, and not written; 47df930be7Sderaadtit is the duty of the system administrator to properly create 48df930be7Sderaadtand maintain this file. 49df930be7SderaadtEach filesystem is described on a separate line; 50df930be7Sderaadtfields on each line are separated by tabs or spaces. 5181e54edfSjmcLines beginning with the 5281e54edfSjmc.Sq # 5381e54edfSjmccharacter are comments and are ignored. 54df930be7SderaadtThe order of records in 55431305c8Saaron.Nm 56df930be7Sderaadtis important because 5753b019d2Sbluhm.Xr fsck 8 58df930be7Sderaadtand 5953b019d2Sbluhm.Xr mount 8 60df930be7Sderaadtsequentially iterate through 61431305c8Saaron.Nm 62df930be7Sderaadtdoing their thing. 63df930be7Sderaadt.Pp 6481e54edfSjmcA line has the following format: 6581e54edfSjmc.Bd -literal -offset indent 6681e54edfSjmcfs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno 6781e54edfSjmc.Ed 6881e54edfSjmc.Pp 69df930be7SderaadtThe first field, 70ae8c025fSaaron.Fa fs_spec , 71431305c8Saarondescribes the block special device or remote filesystem to be mounted. 721c65e871SjmcA block special device may be specified by pathname 731c65e871Sjmcor by 741c65e871Sjmc.Xr disklabel 8 751c65e871SjmcUID (DUID). 761c65e871SjmcFor filesystems of type MFS 77374cd3b6Shenningthe special file name is typically that of the primary swap area; 78374cd3b6Shenningif the keyword 79374cd3b6Shenning.Dq swap 80374cd3b6Shenningis used instead of a special file name, 81374cd3b6Shenningdefault configuration parameters are used. 82df930be7SderaadtIf a program needs the character special file name, 83ae8c025fSaaronthe program must create it by appending an 841c65e871Sjmc.Sq r 85431305c8Saaronafter the last 861c65e871Sjmc.Sq / 87ae8c025fSaaronin the special file name. 88df930be7Sderaadt.Pp 89df930be7SderaadtThe second field, 90ae8c025fSaaron.Fa fs_file , 91df930be7Sderaadtdescribes the mount point for the filesystem. 92ae8c025fSaaronFor swap partitions, this field should be specified as 93ae8c025fSaaron.Dq none . 94df930be7Sderaadt.Pp 95df930be7SderaadtThe third field, 96ae8c025fSaaron.Fa fs_vfstype , 97df930be7Sderaadtdescribes the type of the filesystem. 98dd380c7cSjmcThe system currently supports the following types of filesystems: 99ae8c025fSaaron.Pp 100ae8c025fSaaron.Bl -tag -width indent -offset indent -compact 101ae8c025fSaaron.It cd9660 102ae8c025fSaaronAn ISO 9660 CD-ROM filesystem. 103dd380c7cSjmc.It ext2fs 104dd380c7cSjmcA local Linux compatible ext2fs 105dd380c7cSjmcfilesystem. 106ae8c025fSaaron.It ffs 107ae8c025fSaaronA local 1088b5bc1e6Smillert.Ux 1098b5bc1e6Smillertfilesystem. 110ae8c025fSaaron.It mfs 111ae8c025fSaaronA local memory-based 1128b5bc1e6Smillert.Ux 113ae8c025fSaaronfilesystem. 114ae8c025fSaaron.It msdos 1158b5bc1e6SmillertAn 1168b5bc1e6Smillert.Tn MS-DOS 1178b5bc1e6SmillertFAT filesystem. 118ae8c025fSaaron.It nfs 119ae8c025fSaaronA Sun Microsystems compatible Network File System. 120dd380c7cSjmc.It ntfs 121dd380c7cSjmcAn NTFS filesystem. 122ae8c025fSaaron.It swap 123ae8c025fSaaronA disk partition to be used for swapping. 124cf64c3bfSbrad.It tmpfs 125cf64c3bfSbradA local memory-based 126cf64c3bfSbrad.Ux 127cf64c3bfSbradfilesystem. 128dd380c7cSjmc.It udf 129dd380c7cSjmcA UDF filesystem. 1305916d17dSjmc.It vnd 1315916d17dSjmcA VND image file. 132df930be7Sderaadt.El 133df930be7Sderaadt.Pp 134df930be7SderaadtThe fourth field, 135ae8c025fSaaron.Fa fs_mntops , 136df930be7Sderaadtdescribes the mount options associated with the filesystem. 137df930be7SderaadtIt is formatted as a comma separated list of options. 138df930be7SderaadtIt contains at least the type of mount (see 139df930be7Sderaadt.Fa fs_type 140431305c8Saaronbelow) plus any additional options appropriate to the filesystem type. 141df930be7Sderaadt.Pp 142ae8c025fSaaronThe option 143ae8c025fSaaron.Dq auto 144ae8c025fSaaroncan be used in the 145ae8c025fSaaron.Dq noauto 146ae8c025fSaaronform to cause 147ae8c025fSaarona file system not to be mounted automatically (with 14853a23447Sjmc.Ic mount -A 14953a23447Sjmcor 150ae8c025fSaaron.Ic mount -a , 151ae8c025fSaaronor at system boot time). 152a23815a3SjmcSimilarly, the option 1536dd72aa5Sclaudio.Dq net 1546dd72aa5Sclaudiocan be used to cause a file system to be considered only if the 155a23815a3Sjmc.Fl N 1566dd72aa5Sclaudioflag is passed to 1576dd72aa5Sclaudio.Xr mount 8 1586dd72aa5Sclaudioor 1596dd72aa5Sclaudio.Xr fsck 8 . 1608d49e67cSderaadt.Pp 161ae8c025fSaaronIf the options 162ae8c025fSaaron.Dq userquota 163ae8c025fSaaronand/or 164ae8c025fSaaron.Dq groupquota 165431305c8Saaronare specified, the filesystem is automatically processed by the 166df930be7Sderaadt.Xr quotacheck 8 167df930be7Sderaadtcommand, and user and/or group disk quotas are enabled with 168df930be7Sderaadt.Xr quotaon 8 . 169431305c8SaaronBy default, filesystem quotas are maintained in files named 170df930be7Sderaadt.Pa quota.user 171df930be7Sderaadtand 172df930be7Sderaadt.Pa quota.group 173df930be7Sderaadtwhich are located at the root of the associated filesystem. 174df930be7SderaadtThese defaults may be overridden by putting an equal sign 175df930be7Sderaadtand an alternative absolute pathname following the quota option. 176df930be7SderaadtThus, if the user quota file for 177df930be7Sderaadt.Pa /tmp 178df930be7Sderaadtis stored in 179df930be7Sderaadt.Pa /var/quotas/tmp.user , 180df930be7Sderaadtthis location can be specified as: 181df930be7Sderaadt.Bd -literal -offset indent 182df930be7Sderaadtuserquota=/var/quotas/tmp.user 183df930be7Sderaadt.Ed 184df930be7Sderaadt.Pp 1851c284003SkstaileyThe type of the mount is extracted from the first parameter of the 186df930be7Sderaadt.Fa fs_mntops 187df930be7Sderaadtfield and stored separately in the 188df930be7Sderaadt.Fa fs_type 189df930be7Sderaadtfield (it is not deleted from the 190df930be7Sderaadt.Fa fs_mntops 191df930be7Sderaadtfield). 192df930be7SderaadtIf 193df930be7Sderaadt.Fa fs_type 194ae8c025fSaaronis 19509e9fc6bSjmc.Dq rw , 19609e9fc6bSjmc.Dq rq , 197ae8c025fSaaronor 198ae8c025fSaaron.Dq ro 199ae8c025fSaaronthen the filesystem whose name is given in the 200df930be7Sderaadt.Fa fs_file 201df930be7Sderaadtfield is normally mounted read-write or read-only on the 202df930be7Sderaadtspecified special file. 203df930be7SderaadtIf 204df930be7Sderaadt.Fa fs_type 205ae8c025fSaaronis 206ae8c025fSaaron.Dq sw 207431305c8Saaronthen the special file is made available as a piece of swap space by the 208df930be7Sderaadt.Xr swapon 8 209df930be7Sderaadtcommand at the end of the system reboot procedure. 210df930be7SderaadtThe fields other than 211df930be7Sderaadt.Fa fs_spec 212df930be7Sderaadtand 213df930be7Sderaadt.Fa fs_type 214df930be7Sderaadtare unused. 215df930be7SderaadtIf 216df930be7Sderaadt.Fa fs_type 217ae8c025fSaaronis specified as 21841ce3b17Snaddy.Dq xx , 219ae8c025fSaaronthe entry is ignored. 220df930be7SderaadtThis is useful to show disk partitions which are currently unused. 221df930be7Sderaadt.Pp 222df930be7SderaadtThe fifth field, 223ae8c025fSaaron.Fa fs_freq , 2244f4e5e04Sjmcis used by the 2254f4e5e04Sjmc.Fl W 2264f4e5e04Sjmcand 2274f4e5e04Sjmc.Fl w 2284f4e5e04Sjmcoptions of 229df930be7Sderaadt.Xr dump 8 2304f4e5e04Sjmcto recommend which filesystems should be backed up. 2314f4e5e04SjmcThe value specifies the number of days 2324f4e5e04Sjmcafter which a dump is regarded as being old; 2334f4e5e04Sjmcif it is not present, a value of zero is returned and 2348009c66aSmpech.Xr dump 8 235df930be7Sderaadtwill assume that the filesystem does not need to be dumped. 236df930be7Sderaadt.Pp 237df930be7SderaadtThe sixth field, 238ae8c025fSaaron.Fa fs_passno , 239df930be7Sderaadtis used by the 240df930be7Sderaadt.Xr fsck 8 241df930be7Sderaadtprogram to determine the order in which filesystem checks are done 242df930be7Sderaadtat reboot time. 243df930be7SderaadtThe root filesystem should be specified with a 244df930be7Sderaadt.Fa fs_passno 245df930be7Sderaadtof 1, and other filesystems should have a 246df930be7Sderaadt.Fa fs_passno 247df930be7Sderaadtof 2. 248df930be7SderaadtFilesystems within a drive will be checked sequentially, 249df930be7Sderaadtbut filesystems on different drives will be checked at the 250df930be7Sderaadtsame time to utilize parallelism available in the hardware. 2511667a65fSderaadtIf the sixth field is not present or is zero, 252df930be7Sderaadta value of zero is returned and 253ae8c025fSaaron.Xr fsck 8 254df930be7Sderaadtwill assume that the filesystem does not need to be checked. 255df930be7Sderaadt.Bd -literal 25609e9fc6bSjmc#define FSTAB_RW "rw" /* read/write device */ 257fae9e545Sjmc#define FSTAB_RQ "rq" /* read/write with quotas */ 258df930be7Sderaadt#define FSTAB_RO "ro" /* read-only device */ 259df930be7Sderaadt#define FSTAB_SW "sw" /* swap device */ 260df930be7Sderaadt#define FSTAB_XX "xx" /* ignore totally */ 261df930be7Sderaadt 262df930be7Sderaadtstruct fstab { 263df930be7Sderaadt char *fs_spec; /* block special device name */ 264df930be7Sderaadt char *fs_file; /* filesystem path prefix */ 265df930be7Sderaadt char *fs_vfstype; /* type of filesystem */ 266df930be7Sderaadt char *fs_mntops; /* comma separated mount options */ 26709e9fc6bSjmc char *fs_type; /* rw, rq, ro, sw, or xx */ 268df930be7Sderaadt int fs_freq; /* dump frequency, in days */ 269144cca96Sderaadt int fs_passno; /* pass number on parallel fsck */ 270df930be7Sderaadt}; 271df930be7Sderaadt.Ed 272df930be7Sderaadt.Pp 273df930be7SderaadtThe proper way to read records from 274df930be7Sderaadt.Pa fstab 275df930be7Sderaadtis to use the routines 276df930be7Sderaadt.Xr getfsent 3 , 277df930be7Sderaadt.Xr getfsspec 3 , 278df930be7Sderaadtand 279df930be7Sderaadt.Xr getfsfile 3 . 2803b1d4ce7Sjmc.Sh FILES 2813b1d4ce7Sjmc.Bl -tag -width /etc/fstab -compact 2823b1d4ce7Sjmc.It Pa /etc/fstab 2833b1d4ce7Sjmc.El 284bf3ea4f8Sderaadt.Sh EXAMPLES 285bf3ea4f8SderaadtHere is a sample 286bf3ea4f8Sderaadt.Pa /etc/fstab 287bf3ea4f8Sderaadtfile: 288bf3ea4f8Sderaadt.Bd -literal -offset indent 28943fc2dc2Skrw/dev/sd0b none swap sw 29043fc2dc2Skrw/dev/sd1b none swap sw 291bf3ea4f8Sderaadt/dev/sd0a / ffs rw 1 1 2925c7f7ea8Sderaadt/dev/sd0e /var ffs rw,nodev,nosuid 1 2 293e5b01903Sjmc#/dev/sd0f /tmp ffs rw,nodev,nosuid 1 2 294374cd3b6Shenningswap /tmp mfs rw,nodev,nosuid,-s=153600 0 0 295e5b01903Sjmc/dev/sd0g /usr ffs rw,nodev 1 2 296e5b01903Sjmc/dev/sd0h /usr/local ffs rw,nodev 1 2 297e5b01903Sjmc/dev/sd0i /home ffs rw,nodev,nosuid 1 2 298*e50e3288Sjob/dev/sd0j /usr/src ffs rw,nodev,nosuid 1 2 299c69d4999Sajacoutot/dev/cd0a /cdrom cd9660 ro,noauto 0 0 3001c65e871Sjmc5b27c2761a9b0b06.i /mnt/key msdos rw,noauto 0 0 3017419d3baShenningserver:/export/ports /usr/ports nfs rw,nodev,nosuid,soft,intr 0 0 302bf3ea4f8Sderaadt.Ed 303df930be7Sderaadt.Sh SEE ALSO 30488f98046Smiod.Xr quota 1 , 3058927829bSmiod.Xr getfsent 3 , 3068927829bSmiod.Xr fsck 8 , 3078927829bSmiod.Xr mount 8 , 30888f98046Smiod.Xr quotacheck 8 , 30953b019d2Sbluhm.Xr quotaon 8 310df930be7Sderaadt.Sh HISTORY 311df930be7SderaadtThe 312df930be7Sderaadt.Nm 313df930be7Sderaadtfile format appeared in 314df930be7Sderaadt.Bx 4.0 . 315