1.\" $OpenBSD: mount.8,v 1.92 2023/11/10 00:26:00 schwarze Exp $ 2.\" $NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd Exp $ 3.\" 4.\" Copyright (c) 1980, 1989, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)mount.8 8.7 (Berkeley) 3/27/94 32.\" 33.Dd $Mdocdate: November 10 2023 $ 34.Dt MOUNT 8 35.Os 36.Sh NAME 37.Nm mount 38.Nd mount file systems 39.Sh SYNOPSIS 40.Nm mount 41.Op Fl AadfNruvw 42.Op Fl t Ar type 43.Nm mount 44.Op Fl dfrsuvw 45.Ar special | node 46.Nm mount 47.Op Fl dfruvw 48.Op Fl o Ar options 49.Op Fl t Ar type 50.Ar special node 51.Sh DESCRIPTION 52The 53.Nm 54command invokes a file system specific program to prepare 55and graft the 56.Ar special 57device or remote node (rhost:path) on to the file system 58tree at the point 59.Ar node . 60If either 61.Ar special 62or 63.Ar node 64are not provided, the appropriate information is taken from the 65.Xr fstab 5 66file. 67.Pp 68For disk partitions, the 69.Ar special 70device is either a 71.Xr disklabel 8 72UID (DUID) or an entry in 73.Pa /dev . 74If it is a DUID, 75it will be automatically mapped to the appropriate entry in 76.Pa /dev . 77In either case the partition must be present 78in the disklabel loaded from the device. 79The partition name is the last letter in the entry name. 80For example, /dev/sd0a and 3eb7f9da875cb9ee.a both refer to the 81.Sq a 82partition. 83.Pp 84A mount point 85.Ar node 86must be an existing directory for a mount to succeed 87.Po 88except in the special case of 89.Pa / , 90of course 91.Pc . 92Only the superuser may mount file systems. 93.Pp 94The system maintains a list of currently mounted file systems. 95If no arguments are given to 96.Nm mount , 97this list is printed. 98.Pp 99The options are as follows: 100.Bl -tag -width Ds 101.It Fl A 102Causes 103.Nm 104to try to mount all of the file systems listed in the 105.Xr fstab 5 106table except those for which the 107.Dq noauto 108or 109.Dq net 110options are specified. 111.It Fl a 112Similar to the 113.Fl A 114flag, except that if a file system (other than the root file system) 115appears to be already mounted, 116.Nm 117will not try to mount it again. 118.Nm 119assumes that a file system is already mounted if a file system with 120the same type is mounted on the given mount point. 121More stringent checks are not possible because some file system types 122report strange values for the mounted-from device for mounted file 123systems. 124.It Fl d 125Causes everything to be done except for the invocation of 126the file system specific program. 127This option is useful in conjunction with the 128.Fl v 129flag to 130determine what the 131.Nm 132command is trying to do. 133.It Fl f 134Either force mounting of dirty file systems or, in the case of a 135downgrade from read-write to read-only operation, the revocation of 136opened files with write access. 137.It Fl N 138If used with either 139.Fl A 140or 141.Fl a , 142.Nm 143will only look at file systems which have the 144.Dq net 145option specified. 146By default file systems with the 147.Dq net 148option are ignored. 149.It Fl o Ar options 150Options can be given with (or without) a 151.Sq no 152prefix to invert their meaning. 153The options listed below specify non-default values. 154For example, 155.Sq nosync 156is the default, so 157.Sq sync 158can be used to write regular data synchronously. 159Multiple options can be specified in a comma-separated list. 160The available options are as follows: 161.Bl -tag -width 9n 162.It Cm async 163Metadata I/O to the file system should be done asynchronously. 164By default, only regular data is read/written asynchronously. 165.Pp 166This is a 167.Em dangerous 168flag to set since it does not guarantee to keep a consistent 169file system structure on the disk. 170You should not use this flag 171unless you are prepared to recreate the file system should your 172system crash. 173The most common use of this flag is to speed up 174.Xr restore 8 175where it can give a factor of two speed increase. 176.It Cm force 177The same as 178.Fl f ; 179forces the revocation of write access when trying to downgrade 180a file system mount status from read-write to read-only. 181.It Cm noatime 182Do not update atime on files in the system unless the mtime or ctime 183is being changed as well. 184This option is useful for laptops and news servers where one does 185not want the extra disk activity associated with updating the atime. 186.It Cm nodev 187Do not interpret character or block special devices on the file system. 188This option is useful for a server that has file systems containing 189special devices for architectures other than its own. 190.It Cm noexec 191Do not allow execution of any binaries on the mounted file system. 192This option is useful for a server that has file systems containing 193binaries for architectures other than its own. 194.It Cm noperm 195(FFS only) 196Do not check permissions when creating, accessing or modifying files and 197directories in the mounted file system. 198This allows unprivileged users to construct a file hierarchy containing 199special device nodes and files with arbitrary file mode, owner or group 200without restriction. 201Only the owner, group and mode of the root directory of the filesystem 202will be honored so access to the filesystem can be locked down. 203The noperm option also enables the nodev and noexec options to ensure 204that interpretation of the file modes and special devices cannot be 205used to gain privileges. 206.It Cm norw 207An alias for rdonly. 208.It Cm nosuid 209Do not allow set-user-identifier or set-group-identifier bits to take effect. 210.It Cm rdonly 211The same as 212.Fl r ; 213mount the file system read-only (even the superuser may not write it). 214.It Cm ro 215An alias for rdonly. 216.It Cm softdep 217Mount an FFS file system using soft dependencies. 218This option is only supported for compatibility and has no effect on 219.Ox . 220.It Cm sync 221Regular data I/O to the file system should be done synchronously. 222By default, only metadata is read/written synchronously. 223.It Cm update 224The same as 225.Fl u ; 226indicate that the status of an already mounted file system should be changed. 227.It Cm wxallowed 228Processes that ask for memory to be made writeable plus executable 229using the 230.Xr mmap 2 231and 232.Xr mprotect 2 233system calls are killed by default. 234This option allows those processes to continue operation. 235It is typically used on the 236.Pa /usr/local 237filesystem. 238.El 239.Pp 240Any additional options specific to a given file system type (see the 241.Fl t 242option) may be passed as a comma separated list; these options are 243distinguished by a leading 244.Dq \&- 245(dash). 246Options that take a value are specified using the syntax -option=value. 247For example: 248.Bd -literal -offset 3n 249# mount -t mfs -o rw,nodev,nosuid,-s=153600 /dev/sd0b /tmp 250.Ed 251.Pp 252That causes 253.Nm 254to execute the equivalent of: 255.Bd -literal -offset 3n 256# /sbin/mount_mfs -o rw,nodev,nosuid -s 153600 /dev/sd0b /tmp 257.Ed 258.Pp 259The equivalent example in 260.Xr fstab 5 261would be: 262.Bd -literal -offset 3n 263swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0 264.Ed 265.It Fl r 266The file system is to be mounted read-only. 267Mount the file system read-only (even the superuser may not write it). 268The same as the 269.Dq rdonly 270argument to the 271.Fl o 272option. 273.It Fl s 274Skip mounting the file system if it is already mounted. 275See the 276.Fl a 277flag for a description of the criteria used to decide if a file system 278is already mounted. 279.It Fl t Ar type 280The argument following the 281.Fl t 282is used to indicate the file system type. 283The type 284.Ar ffs 285is the default. 286The 287.Fl t 288option can be used 289to indicate that the actions should only be taken on 290file systems of the specified type. 291More than one type may be specified in a comma separated list. 292The list of file system types can be prefixed with 293.Dq no 294to specify the file system types for which action should 295.Em not 296be taken. 297For example, the 298.Nm 299command: 300.Bd -literal -offset indent 301# mount -a -t nonfs,mfs 302.Ed 303.Pp 304mounts all file systems except those of type NFS and MFS. 305.Pp 306.Nm 307will attempt to execute a program in 308.Pa /sbin/mount_ Ns Em XXX 309where 310.Em XXX 311is replaced by the type name. 312For example, NFS file systems are mounted by the program 313.Pa /sbin/mount_nfs . 314.It Fl u 315The 316.Fl u 317flag indicates that the status of an already mounted file 318system should be changed. 319Any of the options discussed above (the 320.Fl o 321option) 322may be changed; 323also a file system can be changed from read-only to read-write 324or vice versa. 325An attempt to change from read-write to read-only will fail if any 326files on the file system are currently open for writing unless the 327.Fl f 328flag is also specified. 329Only options specified on the command line with 330.Fl o 331are changed; 332other file system options are unaltered. 333The options set in the 334.Xr fstab 5 335table are ignored. 336.It Fl v 337Verbose mode. 338.It Fl w 339The file system object is to be read and write. 340.El 341.Pp 342The options specific to the various file system types are 343described in the manual pages for those file systems' 344.Nm mount_XXX 345commands. 346For instance, the options specific to Berkeley 347Fast File Systems are described in the 348.Xr mount_ffs 8 349manual page. 350.Sh FILES 351.Bl -tag -width /etc/fstab -compact 352.It Pa /etc/fstab 353file system table 354.El 355.Sh EXAMPLES 356Mount a CD-ROM on node 357.Pa /mnt/cdrom : 358.Pp 359.Dl # mount -t cd9660 -r /dev/cd0a /mnt/cdrom 360.Pp 361Mount an MS-DOS USB stick with DUID 3eb7f9da875cb9ee on node 362.Pa /mnt/key : 363.Pp 364.Dl # mount -t msdos 3eb7f9da875cb9ee.i /mnt/key 365.Pp 366Graft a remote NFS file system on host 367.Ar host , 368path 369.Pa /path/name , 370on node 371.Pa /mnt/nfs : 372.Pp 373.Dl # mount host:/path/name /mnt/nfs 374.Pp 375Remount 376.Pa /var 377with option 378.Dq dev : 379.Pp 380.Dl # mount -u -o dev /var 381.Sh SEE ALSO 382.Xr mount 2 , 383.Xr fstab 5 , 384.Xr disklabel 8 , 385.Xr mount_cd9660 8 , 386.Xr mount_ext2fs 8 , 387.Xr mount_ffs 8 , 388.Xr mount_mfs 8 , 389.Xr mount_msdos 8 , 390.Xr mount_nfs 8 , 391.Xr mount_ntfs 8 , 392.Xr mount_tmpfs 8 , 393.Xr mount_udf 8 , 394.Xr mount_vnd 8 , 395.Xr showmount 8 , 396.Xr sysctl 8 , 397.Xr umount 8 398.Sh HISTORY 399A 400.Nm 401command appeared in 402.At v1 . 403.Sh CAVEATS 404After a successful 405.Nm mount , 406the permissions on the original mount point determine if 407.Dq \&.\&. 408is accessible from the mounted file system. 409The minimum permissions for 410the mount point for traversal across the mount point in both 411directions to be possible for all users is 0111 (execute for all). 412