1*c7befad6Sschwarze.\" $OpenBSD: mount.8,v 1.92 2023/11/10 00:26:00 schwarze Exp $ 2df930be7Sderaadt.\" $NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd 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. 151ef0d710Smillert.\" 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.\" @(#)mount.8 8.7 (Berkeley) 3/27/94 32df930be7Sderaadt.\" 33*c7befad6Sschwarze.Dd $Mdocdate: November 10 2023 $ 34df930be7Sderaadt.Dt MOUNT 8 35fc8533a3Saaron.Os 36df930be7Sderaadt.Sh NAME 37df930be7Sderaadt.Nm mount 38df930be7Sderaadt.Nd mount file systems 39df930be7Sderaadt.Sh SYNOPSIS 407349792aSaaron.Nm mount 41e9e191aeSjmc.Op Fl AadfNruvw 42df930be7Sderaadt.Op Fl t Ar type 437349792aSaaron.Nm mount 44f362e36bSotto.Op Fl dfrsuvw 45df930be7Sderaadt.Ar special | node 467349792aSaaron.Nm mount 47df930be7Sderaadt.Op Fl dfruvw 48df930be7Sderaadt.Op Fl o Ar options 49df930be7Sderaadt.Op Fl t Ar type 50df930be7Sderaadt.Ar special node 51df930be7Sderaadt.Sh DESCRIPTION 52df930be7SderaadtThe 5358aefd4bSaaron.Nm 5405d692a5Steducommand invokes a file system specific program to prepare 55df930be7Sderaadtand graft the 56df930be7Sderaadt.Ar special 57df930be7Sderaadtdevice or remote node (rhost:path) on to the file system 58df930be7Sderaadttree at the point 59df930be7Sderaadt.Ar node . 60df930be7SderaadtIf either 61df930be7Sderaadt.Ar special 62df930be7Sderaadtor 63df930be7Sderaadt.Ar node 64df930be7Sderaadtare not provided, the appropriate information is taken from the 65df930be7Sderaadt.Xr fstab 5 66df930be7Sderaadtfile. 67df930be7Sderaadt.Pp 68ba98c64dSespieFor disk partitions, the 69ba98c64dSespie.Ar special 70e03fe77cSjmcdevice is either a 71e03fe77cSjmc.Xr disklabel 8 72e03fe77cSjmcUID (DUID) or an entry in 73e03fe77cSjmc.Pa /dev . 74e03fe77cSjmcIf it is a DUID, 75e03fe77cSjmcit will be automatically mapped to the appropriate entry in 76e03fe77cSjmc.Pa /dev . 77e03fe77cSjmcIn either case the partition must be present 78e03fe77cSjmcin the disklabel loaded from the device. 79e03fe77cSjmcThe partition name is the last letter in the entry name. 80e03fe77cSjmcFor example, /dev/sd0a and 3eb7f9da875cb9ee.a both refer to the 81e03fe77cSjmc.Sq a 82e03fe77cSjmcpartition. 83df930be7Sderaadt.Pp 84581d34a0SpjanzenA mount point 85581d34a0Spjanzen.Ar node 86581d34a0Spjanzenmust be an existing directory for a mount to succeed 87581d34a0Spjanzen.Po 88581d34a0Spjanzenexcept in the special case of 89581d34a0Spjanzen.Pa / , 90581d34a0Spjanzenof course 91581d34a0Spjanzen.Pc . 9265c8a8a0SjmcOnly the superuser may mount file systems. 93581d34a0Spjanzen.Pp 94e03fe77cSjmcThe system maintains a list of currently mounted file systems. 95e03fe77cSjmcIf no arguments are given to 96e03fe77cSjmc.Nm mount , 97e03fe77cSjmcthis list is printed. 98e03fe77cSjmc.Pp 99f1ba3473SaaronThe options are as follows: 100f1ba3473Saaron.Bl -tag -width Ds 101df930be7Sderaadt.It Fl A 102df930be7SderaadtCauses 10358aefd4bSaaron.Nm 104df930be7Sderaadtto try to mount all of the file systems listed in the 105ffbe7eb8Sderaadt.Xr fstab 5 106df930be7Sderaadttable except those for which the 107df930be7Sderaadt.Dq noauto 10841e3198cSclaudioor 10941e3198cSclaudio.Dq net 110e9e191aeSjmcoptions are specified. 111df930be7Sderaadt.It Fl a 112df930be7SderaadtSimilar to the 113df930be7Sderaadt.Fl A 114df930be7Sderaadtflag, except that if a file system (other than the root file system) 115df930be7Sderaadtappears to be already mounted, 11658aefd4bSaaron.Nm 117df930be7Sderaadtwill not try to mount it again. 11858aefd4bSaaron.Nm 119df930be7Sderaadtassumes that a file system is already mounted if a file system with 120df930be7Sderaadtthe same type is mounted on the given mount point. 121df930be7SderaadtMore stringent checks are not possible because some file system types 122df930be7Sderaadtreport strange values for the mounted-from device for mounted file 123df930be7Sderaadtsystems. 124df930be7Sderaadt.It Fl d 125df930be7SderaadtCauses everything to be done except for the invocation of 12605d692a5Steduthe file system specific program. 127df930be7SderaadtThis option is useful in conjunction with the 128df930be7Sderaadt.Fl v 129df930be7Sderaadtflag to 130df930be7Sderaadtdetermine what the 13158aefd4bSaaron.Nm 132df930be7Sderaadtcommand is trying to do. 133df930be7Sderaadt.It Fl f 134e63188c1SpvalchevEither force mounting of dirty file systems or, in the case of a 135bd182408Sniklasdowngrade from read-write to read-only operation, the revocation of 136bd182408Sniklasopened files with write access. 13741e3198cSclaudio.It Fl N 13841e3198cSclaudioIf used with either 13941e3198cSclaudio.Fl A 14041e3198cSclaudioor 14141e3198cSclaudio.Fl a , 142e9e191aeSjmc.Nm 14341e3198cSclaudiowill only look at file systems which have the 14441e3198cSclaudio.Dq net 14541e3198cSclaudiooption specified. 14641e3198cSclaudioBy default file systems with the 14741e3198cSclaudio.Dq net 14841e3198cSclaudiooption are ignored. 149b24688ffSderaadt.It Fl o Ar options 150de3b3330SottoOptions can be given with (or without) a 151de3b3330Sotto.Sq no 152de3b3330Sottoprefix to invert their meaning. 153de3b3330SottoThe options listed below specify non-default values. 154de3b3330SottoFor example, 155*c7befad6Sschwarze.Sq nosync 156de3b3330Sottois the default, so 157*c7befad6Sschwarze.Sq sync 158*c7befad6Sschwarzecan be used to write regular data synchronously. 159de3b3330SottoMultiple options can be specified in a comma-separated list. 160de3b3330SottoThe available options are as follows: 161295c03d0Sjmc.Bl -tag -width 9n 16296f11ecdSbentley.It Cm async 16311d26569SjmcMetadata I/O to the file system should be done asynchronously. 16411d26569SjmcBy default, only regular data is read/written asynchronously. 16511d26569Sjmc.Pp 166df930be7SderaadtThis is a 167df930be7Sderaadt.Em dangerous 168d75d9cd0Smillertflag to set since it does not guarantee to keep a consistent 1699615e1d4Saaronfile system structure on the disk. 1709615e1d4SaaronYou should not use this flag 171d75d9cd0Smillertunless you are prepared to recreate the file system should your 1729615e1d4Saaronsystem crash. 1739615e1d4SaaronThe most common use of this flag is to speed up 174d75d9cd0Smillert.Xr restore 8 175d75d9cd0Smillertwhere it can give a factor of two speed increase. 17696f11ecdSbentley.It Cm force 177df930be7SderaadtThe same as 178df930be7Sderaadt.Fl f ; 179df930be7Sderaadtforces the revocation of write access when trying to downgrade 180df930be7Sderaadta file system mount status from read-write to read-only. 18196f11ecdSbentley.It Cm noatime 182297c680fSmillertDo not update atime on files in the system unless the mtime or ctime 183297c680fSmillertis being changed as well. 184297c680fSmillertThis option is useful for laptops and news servers where one does 185297c680fSmillertnot want the extra disk activity associated with updating the atime. 18696f11ecdSbentley.It Cm nodev 187df930be7SderaadtDo not interpret character or block special devices on the file system. 188df930be7SderaadtThis option is useful for a server that has file systems containing 189df930be7Sderaadtspecial devices for architectures other than its own. 19096f11ecdSbentley.It Cm noexec 191df930be7SderaadtDo not allow execution of any binaries on the mounted file system. 192df930be7SderaadtThis option is useful for a server that has file systems containing 193df930be7Sderaadtbinaries for architectures other than its own. 19496f11ecdSbentley.It Cm noperm 1959781d116Sjmc(FFS only) 1962cb36292SnatanoDo not check permissions when creating, accessing or modifying files and 1972cb36292Snatanodirectories in the mounted file system. 1982cb36292SnatanoThis allows unprivileged users to construct a file hierarchy containing 1992cb36292Snatanospecial device nodes and files with arbitrary file mode, owner or group 2002cb36292Snatanowithout restriction. 201465f44c2SnatanoOnly the owner, group and mode of the root directory of the filesystem 202465f44c2Snatanowill be honored so access to the filesystem can be locked down. 2032cb36292SnatanoThe noperm option also enables the nodev and noexec options to ensure 2042cb36292Snatanothat interpretation of the file modes and special devices cannot be 2052cb36292Snatanoused to gain privileges. 20696f11ecdSbentley.It Cm norw 2072ff15811SjmcAn alias for rdonly. 20896f11ecdSbentley.It Cm nosuid 209df930be7SderaadtDo not allow set-user-identifier or set-group-identifier bits to take effect. 21096f11ecdSbentley.It Cm rdonly 211df930be7SderaadtThe same as 212df930be7Sderaadt.Fl r ; 213a3542fadSaaronmount the file system read-only (even the superuser may not write it). 21496f11ecdSbentley.It Cm ro 2150bb51c57SteduAn alias for rdonly. 21696f11ecdSbentley.It Cm softdep 217*c7befad6SschwarzeMount an FFS file system using soft dependencies. 218*c7befad6SschwarzeThis option is only supported for compatibility and has no effect on 219*c7befad6Sschwarze.Ox . 22096f11ecdSbentley.It Cm sync 22111d26569SjmcRegular data I/O to the file system should be done synchronously. 22211d26569SjmcBy default, only metadata is read/written synchronously. 22396f11ecdSbentley.It Cm update 224dad2b5baSjmcThe same as 225dad2b5baSjmc.Fl u ; 226dad2b5baSjmcindicate that the status of an already mounted file system should be changed. 22796f11ecdSbentley.It Cm wxallowed 2289f25ea04SderaadtProcesses that ask for memory to be made writeable plus executable 2299f25ea04Sderaadtusing the 2309f25ea04Sderaadt.Xr mmap 2 2319f25ea04Sderaadtand 2329f25ea04Sderaadt.Xr mprotect 2 2339f25ea04Sderaadtsystem calls are killed by default. 2349f25ea04SderaadtThis option allows those processes to continue operation. 235dad2b5baSjmcIt is typically used on the 2369f25ea04Sderaadt.Pa /usr/local 2379f25ea04Sderaadtfilesystem. 238df930be7Sderaadt.El 239df930be7Sderaadt.Pp 240df930be7SderaadtAny additional options specific to a given file system type (see the 241df930be7Sderaadt.Fl t 242df930be7Sderaadtoption) may be passed as a comma separated list; these options are 243df930be7Sderaadtdistinguished by a leading 244df930be7Sderaadt.Dq \&- 245df930be7Sderaadt(dash). 246df930be7SderaadtOptions that take a value are specified using the syntax -option=value. 24777741768SjmcFor example: 24877741768Sjmc.Bd -literal -offset 3n 24977741768Sjmc# mount -t mfs -o rw,nodev,nosuid,-s=153600 /dev/sd0b /tmp 250df930be7Sderaadt.Ed 251df930be7Sderaadt.Pp 25277741768SjmcThat causes 25358aefd4bSaaron.Nm 254df930be7Sderaadtto execute the equivalent of: 25577741768Sjmc.Bd -literal -offset 3n 25677741768Sjmc# /sbin/mount_mfs -o rw,nodev,nosuid -s 153600 /dev/sd0b /tmp 25777741768Sjmc.Ed 25877741768Sjmc.Pp 25977741768SjmcThe equivalent example in 26077741768Sjmc.Xr fstab 5 26177741768Sjmcwould be: 26277741768Sjmc.Bd -literal -offset 3n 26377741768Sjmcswap /tmp mfs rw,nodev,nosuid,-s=153600 0 0 264df930be7Sderaadt.Ed 265df930be7Sderaadt.It Fl r 266df930be7SderaadtThe file system is to be mounted read-only. 267a3542fadSaaronMount the file system read-only (even the superuser may not write it). 268df930be7SderaadtThe same as the 269df930be7Sderaadt.Dq rdonly 270df930be7Sderaadtargument to the 271df930be7Sderaadt.Fl o 272df930be7Sderaadtoption. 273f362e36bSotto.It Fl s 274f362e36bSottoSkip mounting the file system if it is already mounted. 275f362e36bSottoSee the 276f362e36bSotto.Fl a 277476703dcSaanriotflag for a description of the criteria used to decide if a file system 278f362e36bSottois already mounted. 279df930be7Sderaadt.It Fl t Ar type 280df930be7SderaadtThe argument following the 281df930be7Sderaadt.Fl t 282df930be7Sderaadtis used to indicate the file system type. 283df930be7SderaadtThe type 284df930be7Sderaadt.Ar ffs 285df930be7Sderaadtis the default. 2865eaf1a72SaaronThe 2875eaf1a72Saaron.Fl t 2885eaf1a72Saaronoption can be used 289df930be7Sderaadtto indicate that the actions should only be taken on 290df930be7Sderaadtfile systems of the specified type. 291df930be7SderaadtMore than one type may be specified in a comma separated list. 292df930be7SderaadtThe list of file system types can be prefixed with 293df930be7Sderaadt.Dq no 294df930be7Sderaadtto specify the file system types for which action should 295df930be7Sderaadt.Em not 296df930be7Sderaadtbe taken. 297df930be7SderaadtFor example, the 29858aefd4bSaaron.Nm 299df930be7Sderaadtcommand: 300df930be7Sderaadt.Bd -literal -offset indent 301f314c710Smpech# mount -a -t nonfs,mfs 302df930be7Sderaadt.Ed 303df930be7Sderaadt.Pp 30477741768Sjmcmounts all file systems except those of type NFS and MFS. 305df930be7Sderaadt.Pp 30658aefd4bSaaron.Nm 307df930be7Sderaadtwill attempt to execute a program in 308df930be7Sderaadt.Pa /sbin/mount_ Ns Em XXX 309df930be7Sderaadtwhere 310df930be7Sderaadt.Em XXX 311df930be7Sderaadtis replaced by the type name. 31237446623SjmcFor example, NFS file systems are mounted by the program 313df930be7Sderaadt.Pa /sbin/mount_nfs . 314df930be7Sderaadt.It Fl u 315df930be7SderaadtThe 316df930be7Sderaadt.Fl u 317df930be7Sderaadtflag indicates that the status of an already mounted file 318df930be7Sderaadtsystem should be changed. 319df930be7SderaadtAny of the options discussed above (the 320df930be7Sderaadt.Fl o 321df930be7Sderaadtoption) 322df930be7Sderaadtmay be changed; 323df930be7Sderaadtalso a file system can be changed from read-only to read-write 324df930be7Sderaadtor vice versa. 325df930be7SderaadtAn attempt to change from read-write to read-only will fail if any 326df930be7Sderaadtfiles on the file system are currently open for writing unless the 327df930be7Sderaadt.Fl f 328df930be7Sderaadtflag is also specified. 329c6289b3dSjmcOnly options specified on the command line with 330c6289b3dSjmc.Fl o 331c6289b3dSjmcare changed; 332c6289b3dSjmcother file system options are unaltered. 333195e5a59SangelosThe options set in the 334ffbe7eb8Sderaadt.Xr fstab 5 335195e5a59Sangelostable are ignored. 336df930be7Sderaadt.It Fl v 337df930be7SderaadtVerbose mode. 338df930be7Sderaadt.It Fl w 339df930be7SderaadtThe file system object is to be read and write. 340df930be7Sderaadt.El 341df930be7Sderaadt.Pp 342df930be7SderaadtThe options specific to the various file system types are 343df930be7Sderaadtdescribed in the manual pages for those file systems' 344df930be7Sderaadt.Nm mount_XXX 3459615e1d4Saaroncommands. 3469615e1d4SaaronFor instance, the options specific to Berkeley 347df930be7SderaadtFast File Systems are described in the 348df930be7Sderaadt.Xr mount_ffs 8 349df930be7Sderaadtmanual page. 3502b65e200Sjmc.Sh FILES 3512b65e200Sjmc.Bl -tag -width /etc/fstab -compact 3522b65e200Sjmc.It Pa /etc/fstab 3532b65e200Sjmcfile system table 3542b65e200Sjmc.El 355f9fb160fSderaadt.Sh EXAMPLES 35675764ac1SjmcMount a CD-ROM on node 35775764ac1Sjmc.Pa /mnt/cdrom : 35875764ac1Sjmc.Pp 359c69d4999Sajacoutot.Dl # mount -t cd9660 -r /dev/cd0a /mnt/cdrom 36075764ac1Sjmc.Pp 361e03fe77cSjmcMount an MS-DOS USB stick with DUID 3eb7f9da875cb9ee on node 362e03fe77cSjmc.Pa /mnt/key : 36375764ac1Sjmc.Pp 364e03fe77cSjmc.Dl # mount -t msdos 3eb7f9da875cb9ee.i /mnt/key 36575764ac1Sjmc.Pp 36675764ac1SjmcGraft a remote NFS file system on host 36775764ac1Sjmc.Ar host , 36875764ac1Sjmcpath 36975764ac1Sjmc.Pa /path/name , 37075764ac1Sjmcon node 37175764ac1Sjmc.Pa /mnt/nfs : 37275764ac1Sjmc.Pp 37375764ac1Sjmc.Dl # mount host:/path/name /mnt/nfs 37475764ac1Sjmc.Pp 37575764ac1SjmcRemount 37675764ac1Sjmc.Pa /var 37775764ac1Sjmcwith option 37875764ac1Sjmc.Dq dev : 37975764ac1Sjmc.Pp 38075764ac1Sjmc.Dl # mount -u -o dev /var 381df930be7Sderaadt.Sh SEE ALSO 382df930be7Sderaadt.Xr mount 2 , 383df930be7Sderaadt.Xr fstab 5 , 384ba98c64dSespie.Xr disklabel 8 , 385df930be7Sderaadt.Xr mount_cd9660 8 , 386a79db1ccSespie.Xr mount_ext2fs 8 , 387df930be7Sderaadt.Xr mount_ffs 8 , 388df930be7Sderaadt.Xr mount_mfs 8 , 389df930be7Sderaadt.Xr mount_msdos 8 , 390df930be7Sderaadt.Xr mount_nfs 8 , 391a0e70a0fSjmc.Xr mount_ntfs 8 , 3923338719bSespie.Xr mount_tmpfs 8 , 393e8851720Sjmc.Xr mount_udf 8 , 394afcbe494Sjmc.Xr mount_vnd 8 , 395c617d18eSkn.Xr showmount 8 , 396581d34a0Spjanzen.Xr sysctl 8 , 3977acc01d2Saaron.Xr umount 8 398df930be7Sderaadt.Sh HISTORY 399df930be7SderaadtA 40058aefd4bSaaron.Nm 401df930be7Sderaadtcommand appeared in 402e2e0d09dSschwarze.At v1 . 403028d5877Sjmc.Sh CAVEATS 404028d5877SjmcAfter a successful 405028d5877Sjmc.Nm mount , 406028d5877Sjmcthe permissions on the original mount point determine if 407028d5877Sjmc.Dq \&.\&. 408028d5877Sjmcis accessible from the mounted file system. 409028d5877SjmcThe minimum permissions for 410028d5877Sjmcthe mount point for traversal across the mount point in both 411028d5877Sjmcdirections to be possible for all users is 0111 (execute for all). 412