1.\" 2.\" SPDX-License-Identifier: BSD-3-Clause 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.Dd April 30, 2025 32.Dt MOUNT 8 33.Os 34.Sh NAME 35.Nm mount 36.Nd mount file systems 37.Sh SYNOPSIS 38.Nm 39.Op Fl -libxo 40.Op Fl adflpruvw 41.Op Fl F Ar fstab 42.Op Fl o Ar options 43.Op Fl t Oo Cm no Oc Ns Ar type Ns Op , Ns Ar type ... 44.Nm 45.Op Fl -libxo 46.Op Fl dfpruvw 47.Ar special | node 48.Nm 49.Op Fl -libxo 50.Op Fl dfpruvw 51.Op Fl o Ar options 52.Op Fl t Oo Cm no Oc Ns Ar type Ns Op , Ns Ar type ... 53.Ar special node 54.Sh DESCRIPTION 55The 56.Nm 57utility calls the 58.Xr nmount 2 59system call to prepare and graft a 60.Ar special 61device or the remote node (rhost:path) on to the file system tree at the point 62.Ar node . 63If either 64.Ar special 65or 66.Ar node 67are not provided, the appropriate information is taken from the 68.Xr fstab 5 69file. 70.Pp 71The system maintains a list of currently mounted file systems. 72If no arguments are given to 73.Nm , 74this list is printed. 75.Pp 76The options are as follows: 77.Bl -tag -width indent 78.It Fl -libxo 79Generate output via 80.Xr libxo 3 81in a selection of different human and machine readable formats. 82See 83.Xr xo_parse_args 3 84for details on command line arguments. 85.It Fl a 86All the file systems described in 87.Xr fstab 5 88are mounted. 89Exceptions are those marked as 90.Dq Li noauto , 91those marked as 92.Dq Li late 93(unless the 94.Fl l 95option was specified), 96those excluded by the 97.Fl t 98flag (see below), or if they are already mounted (except the 99root file system which is always remounted to preserve 100traditional single user mode behavior). 101.It Fl d 102Causes everything to be done except for the actual system call. 103This option is useful in conjunction with the 104.Fl v 105flag to 106determine what the 107.Nm 108command is trying to do. 109.It Fl F Ar fstab 110Specify the 111.Pa fstab 112file to use. 113.It Fl f 114Forces the revocation of write access when trying to downgrade 115a file system mount status from read-write to read-only. 116Also 117forces the R/W mount of an unclean file system (dangerous; use with 118caution). 119.It Fl L 120When used in conjunction with the 121.Fl a 122option, mount 123.Em only 124those file systems which are marked as 125.Dq Li late . 126.It Fl l 127When used in conjunction with the 128.Fl a 129option, also mount those file systems which are marked as 130.Dq Li late . 131.It Fl n 132For compatibility with some other implementations, this flag is 133currently a no-op. 134.It Fl o 135Options are specified with a 136.Fl o 137flag followed by a comma separated string of options. 138In case of conflicting options being specified, the rightmost option 139takes effect. 140The following options are available: 141.Bl -tag -width indent 142.It Cm acls 143Enable POSIX.1e Access Control Lists, or ACLs, which can be customized via the 144.Xr setfacl 1 145and 146.Xr getfacl 1 147commands. 148This flag is mutually exclusive with 149.Cm nfsv4acls 150flag. 151.It Cm async 152All I/O to the file system should be done asynchronously. 153This is a 154.Em dangerous 155flag to set, since it does not guarantee that the file system structure 156on the disk will remain consistent. 157For this reason, the 158.Cm async 159flag should be used sparingly, and only when some data recovery 160mechanism is present. 161.It Cm atime 162Update the file access time when reading from a file. 163This is the default. 164.It Cm automounted 165This flag indicates that the file system was mounted by 166.Xr automountd 8 . 167Automounted file systems are automatically unmounted by 168.Xr autounmountd 8 . 169.It Cm autoro 170Mount the file system read-write. 171If that fails with an error that suggests that the media could be read-only, 172then automatically try to mount the file system read-only. 173.It Cm current 174When used with the 175.Fl u 176flag, this is the same as specifying the options currently in effect for 177the mounted file system. 178.It Cm emptydir 179Require that the mount point directory be empty. 180.It Cm force 181The same as 182.Fl f ; 183forces the revocation of write access when trying to downgrade 184a file system mount status from read-write to read-only. 185Also 186forces the R/W mount of an unclean file system (dangerous; use with caution). 187.It Cm fstab 188When used with the 189.Fl u 190flag, this is the same as specifying all the options listed in the 191.Xr fstab 5 192file for the file system. 193.It Cm late 194This file system should be skipped when 195.Nm 196is run with the 197.Fl a 198flag but without the 199.Fl l 200flag. 201.It Cm mountprog Ns = Ns Aq Ar program 202Force 203.Nm 204to use the specified program to mount the file system, instead of calling 205.Xr nmount 2 206directly. 207For example: 208.Bd -literal 209mount -t foofs -o mountprog=/mydir/fooprog /dev/cd0 /mnt 210.Ed 211.It Cm multilabel 212Enable multi-label Mandatory Access Control, or MAC, on the specified file 213system. 214If the file system supports multilabel operation, individual labels will 215be maintained for each object in the file system, rather than using a 216single label for all objects. 217An alternative to the 218.Fl l 219flag in 220.Xr tunefs 8 . 221See 222.Xr mac 4 223for more information, which cause the multilabel mount flag to be set 224automatically at mount-time. 225.It Cm nfsv4acls 226Enable NFSv4 ACLs, which can be customized via the 227.Xr setfacl 1 228and 229.Xr getfacl 1 230commands. 231This flag is mutually exclusive with 232.Cm acls 233flag. 234.It Cm noasync 235Metadata I/O should be done synchronously, while data I/O should be done 236asynchronously. 237This is the default. 238.It Cm noatime 239Do not update the file access time when reading from a file. 240This option 241is useful on file systems where there are large numbers of files and 242performance is more critical than updating the file access time (which is 243rarely ever important). 244This option is currently only supported on local file systems. 245.It Cm noauto 246This file system should be skipped when 247.Nm 248is run with the 249.Fl a 250flag. 251.It Cm noclusterr 252Disable read clustering. 253.It Cm noclusterw 254Disable write clustering. 255.It Cm nocover 256Do not mount if the requested mount point is already 257the root of a mount point. 258.It Cm noexec 259Do not allow execution of any binaries on the mounted file system. 260This option is useful for a server that has file systems containing 261binaries for architectures other than its own. 262Note: This option was not designed as a security feature and no 263guarantee is made that it will prevent malicious code execution; for 264example, it is still possible to execute scripts which reside on a 265.Cm noexec 266mounted partition. 267.It Cm nosuid 268Do not allow set-user-identifier or set-group-identifier bits to take effect. 269Note: this option is worthless if a public available suid or sgid 270wrapper is installed on your system. 271It is set automatically when the user does not have super-user privileges. 272.It Cm nosymfollow 273Do not follow symlinks 274on the mounted file system. 275.It Cm ro 276Mount the filesystem read-only, even the super-user may not write it. 277Equivalent to 278.Fl r . 279.It Cm rw 280Mount the filesystem read-write. 281.It Cm snapshot 282Take a snapshot of the specified filesystem. 283When this option is used, all other options are ignored. 284The 285.Fl u 286flag is required with this option. 287.Pp 288Snapshot files must be created in the file system that is being 289snapshotted. 290You may create up to 20 snapshots per file system. 291Active snapshots are recorded in the superblock, so they persist across unmount 292and remount operations and across system reboots. 293When you are done with a snapshot, it can be removed with the 294.Xr rm 1 295command. 296Snapshots may be removed in any order, however you may not get back all the 297space contained in the snapshot as another snapshot may claim some of the blocks 298that it is releasing. 299Note that the schg flag is set on snapshots to ensure that not even the root 300user can write to them. 301The unlink command makes an exception for snapshot files in that it allows them 302to be removed even though they have the schg flag set, so it is not necessary to 303clear the schg flag before removing a snapshot file. 304.Pp 305Once you have taken a snapshot, there are three interesting things that you can 306do with it: 307.Pp 308.Bl -enum -compact 309.It 310Run 311.Xr fsck 8 312on the snapshot file. 313Assuming that the file system was clean when it was mounted, you should always 314get a clean (and unchanging) result from running fsck on the snapshot. 315This is essentially what the background fsck process does. 316.Pp 317.It 318Run 319.Xr dump 8 320on the snapshot. 321You will get a dump that is consistent with the file system as of the timestamp 322of the snapshot. 323.Pp 324.It 325Mount the snapshot as a frozen image of the file system. 326To mount the snapshot 327.Pa /var/snapshot/snap1 : 328.Bd -literal 329mdconfig -a -t vnode -f /var/snapshot/snap1 -u 4 330mount -r /dev/md4 /mnt 331.Ed 332.Pp 333You can now cruise around your frozen 334.Pa /var 335file system at 336.Pa /mnt . 337Everything will be in the same state that it was at the time the snapshot was 338taken. 339The one exception is that any earlier snapshots will appear as zero length 340files. 341When you are done with the mounted snapshot: 342.Bd -literal 343umount /mnt 344mdconfig -d -u 4 345.Ed 346.El 347.It Cm suiddir 348A directory on the mounted file system will respond to the SUID bit 349being set, by setting the owner of any new files to be the same 350as the owner of the directory. 351New directories will inherit the bit from their parents. 352Execute bits are removed from 353the file, and it will not be given to root. 354.Pp 355This feature is designed for use on fileservers serving PC users via 356ftp, SAMBA, or netatalk. 357It provides security holes for shell users and as 358such should not be used on shell machines, especially on home directories. 359This option requires the SUIDDIR 360option in the kernel to work. 361Only UFS file systems support this option. 362See 363.Xr chmod 2 364for more information. 365.It Cm sync 366All I/O to the file system should be done synchronously. 367.It Cm update 368The same as 369.Fl u ; 370indicate that the status of an already mounted file system should be changed. 371.It Cm union 372Causes the namespace at the mount point to appear as the union 373of the mounted file system root and the existing directory. 374Lookups will be done in the mounted file system first. 375If those operations fail due to a non-existent file the underlying 376directory is then accessed. 377All creates are done in the mounted file system. 378.It Cm untrusted 379The file system is untrusted and the kernel should use more 380extensive checks on the file-system's metadata before using it. 381This option is intended to be used when mounting file systems 382from untrusted media such as USB memory sticks or other 383externally-provided media. 384.El 385.Pp 386Any additional options specific to a file system type that is not 387one of the internally known types (see the 388.Fl t 389option) may be passed as a comma separated list; these options are 390distinguished by a leading 391.Dq \&- 392(dash). 393For example, the 394.Nm 395command: 396.Bd -literal -offset indent 397mount -t cd9660 -o -e /dev/cd0 /cdrom 398.Ed 399.Pp 400causes 401.Nm 402to execute the equivalent of: 403.Bd -literal -offset indent 404/sbin/mount_cd9660 -e /dev/cd0 /cdrom 405.Ed 406.Pp 407Options that take a value are specified using the -option=value syntax: 408.Bd -literal -offset indent 409mount -t msdosfs -o -u=fred,-g=wheel /dev/da0s1 /mnt 410.Ed 411.Pp 412is equivalent to 413.Bd -literal -offset indent 414/sbin/mount_msdosfs -u fred -g wheel /dev/da0s1 /mnt 415.Ed 416.Pp 417Additional options specific to file system types 418which are not internally known 419(see the description of the 420.Fl t 421option below) 422may be described in the manual pages for the associated 423.Pa /sbin/mount_ Ns Sy XXX 424utilities. 425.It Fl p 426Print mount information in 427.Xr fstab 5 428format. 429Implies also the 430.Fl v 431option. 432.It Fl r 433The file system is to be mounted read-only. 434Mount the file system read-only (even the super-user may not write it). 435The same as the 436.Cm ro 437argument to the 438.Fl o 439option. 440.It Fl t Oo Cm no Oc Ns Ar type Ns Op , Ns Ar type ... 441The argument following the 442.Fl t 443is used to indicate the file system type. 444The type 445.Cm ufs 446is the default. 447The 448.Fl t 449option can be used 450to indicate that the actions should only be taken on 451file systems of the specified type. 452More than one type may be specified in a comma separated list. 453The list of file system types can be prefixed with 454.Cm no 455to specify the file system types for which action should 456.Em not 457be taken. 458For example, the 459.Nm 460command: 461.Bd -literal -offset indent 462mount -a -t nonfs,nullfs 463.Ed 464.Pp 465mounts all file systems except those of type NFS and NULLFS. 466.Pp 467The default behavior of 468.Nm 469is to pass the 470.Fl t 471option directly to the 472.Xr nmount 2 473system call in the 474.Li fstype 475option. 476.Pp 477However, for the following file system types: 478.Cm cd9660 , 479.Cm mfs , 480.Cm msdosfs , 481.Cm nfs , 482.Cm nullfs , 483.Cm smbfs , 484.Cm udf , 485and 486.Cm unionfs 487.Nm 488will not call 489.Xr nmount 2 490directly and will instead attempt to execute a program in 491.Pa /sbin/mount_ Ns Ar type 492where 493.Ar type 494is replaced by the file system type name. 495For example, 496.Cm nfs 497file systems are mounted by the program 498.Pa /sbin/mount_nfs . 499.Pp 500Most file systems will be dynamically loaded by the kernel 501if not already present, and if the kernel module is available. 502.It Fl u 503The 504.Fl u 505flag indicates that the status of an already mounted file 506system should be changed. 507Any of the options discussed above (the 508.Fl o 509option) 510may be changed; 511also a file system can be changed from read-only to read-write 512or vice versa. 513An attempt to change from read-write to read-only will fail if any 514files on the file system are currently open for writing unless the 515.Fl f 516flag is also specified. 517The set of options is determined by applying the options specified 518in the argument to 519.Fl o 520and finally applying the 521.Fl r 522or 523.Fl w 524option. 525.It Fl v 526Verbose mode. 527If the 528.Fl v 529is used alone, show all file systems, including those that were mounted with the 530.Dv MNT_IGNORE 531flag and show additional information about each file system (including fsid 532when run by root). 533.It Fl w 534The file system object is to be read and write. 535.El 536.Sh ENVIRONMENT 537.Bl -tag -width ".Ev PATH_FSTAB" 538.It Ev PATH_FSTAB 539If the environment variable 540.Ev PATH_FSTAB 541is set, all operations are performed against the specified file. 542.Ev PATH_FSTAB 543will not be honored if the process environment or memory address space is 544considered 545.Dq tainted . 546(See 547.Xr issetugid 2 548for more information.) 549.El 550.Sh FILES 551.Bl -tag -width /etc/fstab -compact 552.It Pa /etc/fstab 553file system table 554.El 555.Sh EXAMPLES 556Remount the root filesystem with read-write permissions: 557.Pp 558.Dl mount -uw / 559.Sh DIAGNOSTICS 560Various, most of them are self-explanatory. 561.Pp 562.Dl XXXXX file system is not available 563.Pp 564The kernel does not support the respective file system type. 565Note that 566support for a particular file system might be provided either on a static 567(kernel compile-time), or dynamic basis (loaded as a kernel module by 568.Xr kldload 8 ) . 569.Sh SEE ALSO 570.Xr getfacl 1 , 571.Xr setfacl 1 , 572.Xr nmount 2 , 573.Xr acl 3 , 574.Xr getmntinfo 3 , 575.Xr libxo 3 , 576.Xr xo_parse_args 3 , 577.Xr cd9660 4 , 578.Xr devfs 4 , 579.Xr ext2fs 4 , 580.Xr ffs 4 , 581.Xr mac 4 , 582.Xr procfs 4 , 583.Xr tarfs 4 , 584.Xr tmpfs 4 , 585.Xr fstab 5 , 586.Xr automount 8 , 587.Xr fstyp 8 , 588.Xr kldload 8 , 589.Xr mount_cd9660 8 , 590.Xr mount_msdosfs 8 , 591.Xr mount_nfs 8 , 592.Xr mount_nullfs 8 , 593.Xr mount_smbfs 8 , 594.Xr mount_udf 8 , 595.Xr mount_unionfs 8 , 596.Xr quotacheck 8 , 597.Xr umount 8 , 598.Xr zfs 8 , 599.Xr zpool 8 600.Sh HISTORY 601A 602.Nm 603utility appeared in 604.At v1 . 605.Sh CAVEATS 606After a successful 607.Nm , 608the permissions on the original mount point determine if 609.Pa ..\& 610is accessible from the mounted file system. 611The minimum permissions for 612the mount point for traversal across the mount point in both 613directions to be possible for all users is 0111 (execute for all). 614.Pp 615Use of the 616.Nm 617is preferred over the use of the file system specific 618.Pa mount_ Ns Sy XXX 619commands. 620In particular, 621.Xr mountd 8 622gets a 623.Dv SIGHUP 624signal (that causes an update of the export list) 625only when the file system is mounted via 626.Nm . 627.Sh BUGS 628It is possible for a corrupted file system to cause a crash. 629.Pp 630The 631.Fl p 632option will not list 633.Cm userquota 634or 635.Cm groupquota 636items from 637.Xr fstab 5 638because they are not true mount options and are not information returned by 639.Xr getmntinfo 3 . 640At boot 641.Xr quotacheck 8 , 642processes these items. 643