1.\" $NetBSD: mount.8,v 1.80 2014/12/06 12:12:17 mbalmer Exp $ 2.\" 3.\" Copyright (c) 1980, 1989, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)mount.8 8.8 (Berkeley) 6/16/94 31.\" 32.Dd December 6, 2014 33.Dt MOUNT 8 34.Os 35.Sh NAME 36.Nm mount 37.Nd mount file systems 38.Sh SYNOPSIS 39.Nm 40.Op Fl Aadfruvw 41.Op Fl t Ar type 42.Nm 43.Op Fl dfruvw 44.Brq Ar special | Ar node 45.Nm 46.Op Fl dfruvw 47.Op Fl o Ar options 48.Op Fl t Ar type 49.Ar special node 50.Sh DESCRIPTION 51The 52.Nm 53command invokes a file system-specific program to prepare and graft the 54.Ar special 55device on to the file system tree at the point 56.Ar node , 57or to update options for an already-mounted file system. 58.Pp 59The 60.Ar node 61argument is always interpreted as a directory in the name space of 62currently mounted file systems. 63The 64.Ar special 65argument is interpreted in different ways 66by the programs that handle different file system types; 67for example, 68.Xr mount_ffs 8 69interprets it as a device node, 70.Xr mount_null 8 71interprets it as a directory name, 72.Xr mount_nfs 8 73interprets it as reference to a remote host and a directory on that host, 74and 75.Xr mount_tmpfs 8 76ignores it. 77.Pp 78The system maintains a list of currently mounted file systems. 79This list is printed if 80.Nm 81is invoked with no arguments, and with no options that require some 82other behaviour. 83.Pp 84If exactly one of 85.Ar special 86or 87.Ar node 88is provided, then the missing information 89(including the file system type) 90is taken from the 91.Xr fstab 5 92file. 93The provided argument is looked up first in the 94.Dq fs_file , 95then in the 96.Dq fs_spec 97column. 98If the matching entry in 99.Xr fstab 5 100has the string 101.Dq Li from_mount 102as its 103.Dq fs_spec 104field, the device or remote file system already mounted at 105the location specified by 106.Dq fs_spec 107will be used. 108.\" XXX The above paragraph doesn't address the use of "-u" 109.Pp 110If both 111.Ar special 112and 113.Ar node 114are provided, then 115.Xr fstab 5 116is not used. 117In this case, if the file system type is not specified 118via the 119.Fl t 120flag, then 121.Nm 122may determine the type from the disk label (see 123.Xr disklabel 8 ) . 124In addition, if 125.Ar special 126contains a colon 127.Pq Ql \&: 128or at sign 129.Pq Ql \&@ , 130then the 131.Li nfs 132type is inferred, but this behaviour is deprecated, and will be 133removed in a future version of 134.Nm . 135.Pp 136In 137.Nx , 138the file-system mounting policy is dictated by the running security models. 139The default security model may allow unprivileged mounting; see 140.Xr secmodel_suser 9 141and 142.Xr secmodel_extensions 9 143for details. 144.Pp 145The options are as follows: 146.Bl -tag -width indent 147.It Fl A 148Causes 149.Nm 150to try to mount all of the file systems listed in the 151.Xr fstab 5 152file except those for which the 153.Dq noauto 154option is specified. 155.It Fl a 156Similar to the 157.Fl A 158flag, except that if a file system (other than the root file system) 159appears to be already mounted, 160.Nm 161will not try to mount it again. 162.Nm 163assumes that a file system is already mounted if a file system with 164the same type is mounted on the given mount point. 165More stringent checks are not possible because some file system types 166report strange values for the mounted-from device for mounted file 167systems. 168.It Fl d 169Causes everything to be done except for the invocation of 170the file system-specific program. 171This option is useful in conjunction with the 172.Fl v 173flag to determine what the 174.Nm 175command is trying to do. 176.It Fl f 177Forces the revocation of write access when trying to downgrade 178a file system mount status from read-write to read-only. 179.It Fl o 180Options are specified with a 181.Fl o 182flag followed by a comma separated string of options. 183The following options are available: 184.Bl -tag -width nocoredump 185.It Cm async 186All 187.Tn I/O 188to the file system should be done asynchronously. 189In the event of a crash, 190.Em "it is impossible for the system to verify the integrity of data on a file system mounted with this option" . 191You should only use this option if you have an application-specific data 192recovery mechanism, or are willing to recreate the file system from scratch. 193.It Cm noasync 194Clear 195.Cm async 196mode. 197.It Cm discard 198Use DISCARD/TRIM commands if disk and driver support it. 199EXPERIMENTAL! 200.It Cm extattr 201Enable extended attributes, if the filesystem supports them and 202does not enable them by default. 203Currently this is only the case for UFS1. 204.It Cm force 205The same as 206.Fl f ; 207forces the revocation of write access when trying to downgrade 208a file system mount status from read-write to read-only. 209.It Cm getargs 210Retrieves the file system specific mount arguments for the given 211mounted file system and prints them. 212.It Cm hidden 213By setting the 214.Dv MNT_IGNORE 215flag, 216causes the mount point to be excluded from the 217list of file systems shown by default with 218.Xr df 1 . 219.It Cm noatime 220Never update the access time field for files. 221This option is useful for optimizing read performance on file systems 222that are used as news spools. 223.It Cm noauto 224This file system should be skipped when mount is run with the 225.Fl a 226flag. 227.It Cm nocoredump 228Do not allow programs to create crash dumps (core files) on the file system. 229This option can be used to help protect sensitive 230data by keeping core files (which may contain sensitive data) 231from being created on insecure file systems. 232Only core files that would be created by program crashes are 233prevented by use of this flag; the behavior of 234.Xr savecore 8 235is not affected. 236.It Cm nodev 237Do not interpret character or block special devices on the file system. 238This option is useful for a server that has file systems containing 239special devices for architectures other than its own. 240.It Cm nodevmtime 241Do not update modification times on device special files. 242This option is useful on laptops 243or other systems that perform power management. 244.It Cm noexec 245Do not allow execution of any binaries on the mounted file system. 246This option is useful for a server that has file systems containing 247binaries for architectures other than its own. 248.It Cm nosuid 249Do not allow set-user-identifier or set-group-identifier bits to take effect. 250.It Cm port 251(NFS only) Use the specified NFS port. 252.It Cm rdonly 253The same as 254.Fl r ; 255mount the file system read-only (even the super-user may not write it). 256.It Cm reload 257Reload all incore data for a file system. 258This is used mainly after running 259.Xr fsck 8 260on the root file system and finding things to fix. 261The file system must be mounted read-only. 262All cached meta-data are invalidated, superblock and summary information 263is re-read from disk, all cached inactive vnodes and file data are 264invalidated and all inode data are re-read for all active vnodes. 265.It Cm rump 266Instead of running mount_type to mount the file system, run rump_type. 267This uses a userspace server to mount the file system and does not 268require kernel support for the specific file system type. 269See the 270.Fl t 271flag and respective rump_type manual page for more information. 272.It Cm log 273(FFS only) 274Mount the file system with 275.Xr wapbl 4 276meta-data journaling, also known simply as logging. 277It provides rapid metadata updates and eliminates the need to check 278file system consistency after a system outage. 279A file system mounted with 280.Cm log 281can not be mounted with 282.Cm async . 283It requires the 284.Dv WAPBL 285option to be enabled in the running kernel. 286See 287.Xr wapbl 4 288for more information. 289This option requires the 290.Dq UFS2 291.Pq level 4 292superblock layout, which is the default for newly created FFSv1 and 293FFSv2 file systems. 294To update an old file system with an earlier superblock format, 295use the 296.Fl c 297option of 298.Xr fsck_ffs 8 . 299.It Cm symperm 300Recognize permission of symbolic link when reading or traversing link. 301.It Cm sync 302All 303.Tn I/O 304to the file system should be done synchronously. 305This is not equivalent to the normal mode in which only 306metadata is written synchronously. 307.It Cm nosync 308Clear 309.Cm sync 310mode. 311.It Cm union 312Causes the namespace at the mount point to appear as the union 313of the mounted file system root 314(referred to as the 315.Em upper 316layer), and the existing directory 317(referred to as the 318.Em lower 319layer). 320Name lookups will be done in the upper layer first. 321If a name does not exist in the upper layer, then the name 322will be looked up in the lower layer. 323If a name exists in both the upper and lower layers, then only 324the upper instance is accessible. 325Creation of new files is done in the upper layer, 326except in the case of the fdesc file system (see 327.Xr mount_fdesc 8 ) . 328.Pp 329Note that the 330.Cm union 331option can be applied to any type of file system, 332and is fundamentally different from 333.Xr mount_union 8 , 334which is a particular type of file system. 335Also note that the 336.Cm union 337option affects the file system name space only at the mount point 338itself; it does not apply recursively to subdirectories. 339.It Cm update 340The same as 341.Fl u ; 342indicate that the status of an already mounted file system should be changed. 343.El 344.Pp 345Any additional options specific to a given file system type (see the 346.Fl t 347option) may be passed as a comma separated list; these options are 348distinguished by a leading 349.Dq \&- 350(dash). 351Options that take a value are specified using the syntax -option=value. 352For example, the mount command: 353.Bd -literal -offset indent 354mount -t mfs -o nosuid,-N,-s=32m swap /tmp 355.Ed 356.Pp 357causes 358.Nm 359to execute the equivalent of: 360.Bd -literal -offset indent 361/sbin/mount_mfs -o nosuid -N -s 32m swap /tmp 362.Ed 363.It Fl r 364The file system is to be mounted read-only. 365Mount the file system read-only (even the super-user may not write it). 366The same as the 367.Dq rdonly 368argument to the 369.Fl o 370option. 371.It Fl t Ar type 372The argument following the 373.Fl t 374is used to indicate the file system type. 375The type 376.Ar ffs 377is the default. 378The 379.Fl t 380option can be used to indicate that the actions 381should only be taken on file systems of the specified type. 382More than one type may be specified in a comma separated list. 383The list of file system types can be prefixed with 384.Dq no 385to specify the file system types for which action should 386.Em not 387be taken. 388For example, the 389.Nm 390command: 391.Bd -literal -offset indent 392mount -a -t nonfs,mfs 393.Ed 394.Pp 395mounts all file systems except those of type 396.Tn NFS 397and 398.Tn MFS . 399.Pp 400.Nm 401will attempt to execute a program in 402.Pa /sbin/mount_ Ns Em XXX 403where 404.Em XXX 405is replaced by the type name. 406For example, nfs file systems are mounted by the program 407.Pa /sbin/mount_nfs . 408.It Fl u 409The 410.Fl u 411flag indicates that the status of an already mounted file 412system should be changed. 413Any of the options discussed above (the 414.Fl o 415option) 416may be changed; 417also a file system can be changed from read-only to read-write 418or vice versa. 419An attempt to change from read-write to read-only will fail if any 420files on the file system are currently open for writing unless the 421.Fl f 422flag is also specified. 423The set of options is determined by first extracting the options 424for the file system from the 425.Xr fstab 5 426file, then applying any options specified by the 427.Fl o 428argument, 429and finally applying the 430.Fl r 431or 432.Fl w 433option. 434.It Fl v 435Verbose mode. 436If this flag is specified more than once, then the 437file system-specific mount arguments are printed for the given mounted 438file system. 439.It Fl w 440The file system object is to be read and write. 441.El 442.Pp 443The options specific to the various file system types are 444described in the manual pages for those file systems' 445.Nm mount_XXX 446commands; 447for instance, the options specific to Berkeley 448Fast File System (FFS) are described in the 449.Xr mount_ffs 8 450manual page. 451.Pp 452The particular type of file system in each partition of a disk can 453be found by examining the disk label with the 454.Xr disklabel 8 455command. 456.Sh FILES 457.Bl -tag -width /etc/fstab -compact 458.It Pa /etc/fstab 459file system table 460.El 461.Sh EXAMPLES 462Some useful examples: 463.Bl -hang -offset indent -width "MS-DOS" 464.It Tn CD-ROM 465.br 466mount -t cd9660 -r /dev/cd0a /cdrom 467.It Tn MS-DOS 468.br 469mount -t msdos /dev/fd0a /floppy 470.It Tn NFS 471.br 472mount -t nfs nfs-server-host:/directory/path /mount-point 473.It Tn MFS (32 megabyte) 474.br 475mount -t mfs -o nosuid,-s=32m swap /tmp 476.El 477.Pp 478The 479.Dq noauto 480directive in 481.Pa /etc/fstab 482can be used to make it easy to manually mount and unmount removable 483media using just the mountpoint filename, with an entry like this: 484.Pp 485.Dl /dev/cd0a /cdrom cd9660 ro,noauto 0 0 486.Pp 487That would allow a simple command like 488.Qq mount /cdrom 489or 490.Qq umount /cdrom 491for media using the 492.Tn ISO-9660 493file system format in the first 494.Tn CD-ROM 495drive. 496.Sh DIAGNOSTICS 497The error 498.Dq Operation not supported by device 499indicates that the mount for the specified file-system type cannot be 500completed because the kernel lacks support for the said file-system. 501See 502.Xr options 4 . 503.Pp 504The error 505.Dq Operation not permitted 506may indicate that the mount options include privileged options and/or 507don't include options that exclude privileged options. 508One should try using at least 509.Dq nodev 510and 511.Dq nosuid 512in such cases: 513.Bd -literal -offset indent 514mount -t cd9660 -o nodev,nosuid /dev/cd0a /mnt 515.Ed 516.Sh SEE ALSO 517.Xr df 1 , 518.Xr mount 2 , 519.Xr options 4 , 520.Xr wapbl 4 , 521.Xr fstab 5 , 522.Xr disklabel 8 , 523.Xr fsck 8 , 524.Xr mount_ados 8 , 525.Xr mount_cd9660 8 , 526.Xr mount_chfs 8 , 527.Xr mount_ext2fs 8 , 528.Xr mount_fdesc 8 , 529.Xr mount_ffs 8 , 530.Xr mount_filecore 8 , 531.Xr mount_kernfs 8 , 532.Xr mount_lfs 8 , 533.Xr mount_mfs 8 , 534.Xr mount_msdos 8 , 535.Xr mount_nfs 8 , 536.Xr mount_ntfs 8 , 537.Xr mount_null 8 , 538.Xr mount_overlay 8 , 539.Xr mount_portal 8 , 540.Xr mount_procfs 8 , 541.Xr mount_tmpfs 8 , 542.Xr mount_udf 8 , 543.Xr mount_umap 8 , 544.Xr mount_union 8 , 545.Xr rump_cd9660 8 , 546.Xr rump_efs 8 , 547.Xr rump_ext2fs 8 , 548.Xr rump_ffs 8 , 549.Xr rump_hfs 8 , 550.Xr rump_lfs 8 , 551.Xr rump_msdos 8 , 552.Xr rump_nfs 8 , 553.Xr rump_ntfs 8 , 554.Xr rump_smbfs 8 , 555.Xr rump_sysvbfs 8 , 556.Xr rump_tmpfs 8 , 557.Xr rump_udf 8 , 558.Xr umount 8 559.Sh HISTORY 560A 561.Nm 562command appeared in 563.At v6 . 564