1.\" Copyright (c) 1980, 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 4. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)mount.8 8.8 (Berkeley) 6/16/94 29.\" $FreeBSD$ 30.\" 31.Dd July 12, 2012 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 adflpruvw 40.Op Fl F Ar fstab 41.Op Fl o Ar options 42.Op Fl t Cm ufs | Ar external_type 43.Nm 44.Op Fl dfpruvw 45.Ar special | node 46.Nm 47.Op Fl dfpruvw 48.Op Fl o Ar options 49.Op Fl t Cm ufs | Ar external_type 50.Ar special node 51.Sh DESCRIPTION 52The 53.Nm 54utility calls the 55.Xr nmount 2 56system call to prepare and graft a 57.Ar special 58device or the remote node (rhost:path) on to the file system tree 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 68The system maintains a list of currently mounted file systems. 69If no arguments are given to 70.Nm , 71this list is printed. 72.Pp 73The options are as follows: 74.Bl -tag -width indent 75.It Fl a 76All the file systems described in 77.Xr fstab 5 78are mounted. 79Exceptions are those marked as 80.Dq Li noauto , 81those marked as 82.Dq Li late 83(unless the 84.Fl l 85option was specified), 86those excluded by the 87.Fl t 88flag (see below), or if they are already mounted (except the 89root file system which is always remounted to preserve 90traditional single user mode behavior). 91.It Fl d 92Causes everything to be done except for the actual system call. 93This option is useful in conjunction with the 94.Fl v 95flag to 96determine what the 97.Nm 98command is trying to do. 99.It Fl F Ar fstab 100Specify the 101.Pa fstab 102file to use. 103.It Fl f 104Forces the revocation of write access when trying to downgrade 105a file system mount status from read-write to read-only. 106Also 107forces the R/W mount of an unclean file system (dangerous; use with 108caution). 109.It Fl L 110When used in conjunction with the 111.Fl a 112option, mount 113.Em only 114those file systems which are marked as 115.Dq Li late . 116.It Fl l 117When used in conjunction with the 118.Fl a 119option, also mount those file systems which are marked as 120.Dq Li late . 121.It Fl o 122Options are specified with a 123.Fl o 124flag followed by a comma separated string of options. 125In case of conflicting options being specified, the rightmost option 126takes effect. 127The following options are available: 128.Bl -tag -width indent 129.It Cm acls 130Enable POSIX.1e Access Control Lists, or ACLs, which can be customized via the 131.Xr setfacl 1 132and 133.Xr getfacl 1 134commands. 135This flag is mutually exclusive with 136.Cm nfsv4acls 137flag. 138.It Cm async 139All 140.Tn I/O 141to the file system should be done asynchronously. 142This is a 143.Em dangerous 144flag to set, since it does not guarantee that the file system structure 145on the disk will remain consistent. 146For this reason, the 147.Cm async 148flag should be used sparingly, and only when some data recovery 149mechanism is present. 150.It Cm current 151When used with the 152.Fl u 153flag, this is the same as specifying the options currently in effect for 154the mounted file system. 155.It Cm failok 156If this option is specified, 157.Nm 158will return 0 even if an error occurs 159during the mount of the filesystem. 160.It Cm force 161The same as 162.Fl f ; 163forces the revocation of write access when trying to downgrade 164a file system mount status from read-write to read-only. 165Also 166forces the R/W mount of an unclean file system (dangerous; use with caution). 167.It Cm fstab 168When used with the 169.Fl u 170flag, this is the same as specifying all the options listed in the 171.Xr fstab 5 172file for the file system. 173.It Cm late 174This file system should be skipped when 175.Nm 176is run with the 177.Fl a 178flag but without the 179.Fl l 180flag. 181.It Cm mountprog Ns = Ns Aq Ar program 182Force 183.Nm 184to use the specified program to mount the file system, instead of calling 185.Xr nmount 2 186directly. 187For example: 188.Bd -literal 189mount -t foofs -o mountprog=/mydir/fooprog /dev/acd0 /mnt 190.Ed 191.It Cm multilabel 192Enable multi-label Mandatory Access Control, or MAC, on the specified file 193system. 194If the file system supports multilabel operation, individual labels will 195be maintained for each object in the file system, rather than using a 196single label for all objects. 197An alternative to the 198.Fl l 199flag in 200.Xr tunefs 8 . 201See 202.Xr mac 4 203for more information, which cause the multilabel mount flag to be set 204automatically at mount-time. 205.It Cm nfsv4acls 206Enable NFSv4 ACLs, which can be customized via the 207.Xr setfacl 1 208and 209.Xr getfacl 1 210commands. 211This flag is mutually exclusive with 212.Cm acls 213flag. 214.It Cm noasync 215Metadata I/O should be done synchronously, while data I/O should be done 216asynchronously. 217This is the default. 218.It Cm noatime 219Do not update the file access time when reading from a file. 220This option 221is useful on file systems where there are large numbers of files and 222performance is more critical than updating the file access time (which is 223rarely ever important). 224This option is currently only supported on local file systems. 225.It Cm noauto 226This file system should be skipped when 227.Nm 228is run with the 229.Fl a 230flag. 231.It Cm noclusterr 232Disable read clustering. 233.It Cm noclusterw 234Disable write clustering. 235.It Cm noexec 236Do not allow execution of any binaries on the mounted file system. 237This option is useful for a server that has file systems containing 238binaries for architectures other than its own. 239Note: This option was not designed as a security feature and no 240guarantee is made that it will prevent malicious code execution; for 241example, it is still possible to execute scripts which reside on a 242.Cm noexec 243mounted partition. 244.It Cm nosuid 245Do not allow set-user-identifier or set-group-identifier bits to take effect. 246Note: this option is worthless if a public available suid or sgid 247wrapper like 248.Xr suidperl 1 249is installed on your system. 250It is set automatically when the user does not have super-user privileges. 251.It Cm nosymfollow 252Do not follow symlinks 253on the mounted file system. 254.It Cm ro 255The same as 256.Fl r ; 257mount the file system read-only (even the super-user may not write it). 258.It Cm snapshot 259This option allows a snapshot of the specified file system to be taken. 260The 261.Fl u 262flag is required with this option. 263Note that snapshot files must be created in the file system that is being 264snapshotted. 265You may create up to 20 snapshots per file system. 266Active snapshots are recorded in the superblock, so they persist across unmount 267and remount operations and across system reboots. 268When you are done with a snapshot, it can be removed with the 269.Xr rm 1 270command. 271Snapshots may be removed in any order, however you may not get back all the 272space contained in the snapshot as another snapshot may claim some of the blocks 273that it is releasing. 274Note that the schg flag is set on snapshots to ensure that not even the root 275user can write to them. 276The unlink command makes an exception for snapshot files in that it allows them 277to be removed even though they have the schg flag set, so it is not necessary to 278clear the schg flag before removing a snapshot file. 279.Pp 280Once you have taken a snapshot, there are three interesting things that you can 281do with it: 282.Pp 283.Bl -enum -compact 284.It 285Run 286.Xr fsck 8 287on the snapshot file. 288Assuming that the file system was clean when it was mounted, you should always 289get a clean (and unchanging) result from running fsck on the snapshot. 290This is essentially what the background fsck process does. 291.Pp 292.It 293Run 294.Xr dump 8 295on the snapshot. 296You will get a dump that is consistent with the file system as of the timestamp 297of the snapshot. 298.Pp 299.It 300Mount the snapshot as a frozen image of the file system. 301To mount the snapshot 302.Pa /var/snapshot/snap1 : 303.Bd -literal 304mdconfig -a -t vnode -f /var/snapshot/snap1 -u 4 305mount -r /dev/md4 /mnt 306.Ed 307.Pp 308You can now cruise around your frozen 309.Pa /var 310file system at 311.Pa /mnt . 312Everything will be in the same state that it was at the time the snapshot was 313taken. 314The one exception is that any earlier snapshots will appear as zero length 315files. 316When you are done with the mounted snapshot: 317.Bd -literal 318umount /mnt 319mdconfig -d -u 4 320.Ed 321.El 322.It Cm suiddir 323A directory on the mounted file system will respond to the SUID bit 324being set, by setting the owner of any new files to be the same 325as the owner of the directory. 326New directories will inherit the bit from their parents. 327Execute bits are removed from 328the file, and it will not be given to root. 329.Pp 330This feature is designed for use on fileservers serving PC users via 331ftp, SAMBA, or netatalk. 332It provides security holes for shell users and as 333such should not be used on shell machines, especially on home directories. 334This option requires the SUIDDIR 335option in the kernel to work. 336Only UFS file systems support this option. 337See 338.Xr chmod 2 339for more information. 340.It Cm sync 341All 342.Tn I/O 343to the file system should be done synchronously. 344.It Cm update 345The same as 346.Fl u ; 347indicate that the status of an already mounted file system should be changed. 348.It Cm union 349Causes the namespace at the mount point to appear as the union 350of the mounted file system root and the existing directory. 351Lookups will be done in the mounted file system first. 352If those operations fail due to a non-existent file the underlying 353directory is then accessed. 354All creates are done in the mounted file system. 355.El 356.Pp 357Any additional options specific to a file system type that is not 358one of the internally known types (see the 359.Fl t 360option) may be passed as a comma separated list; these options are 361distinguished by a leading 362.Dq \&- 363(dash). 364For example, the 365.Nm 366command: 367.Bd -literal -offset indent 368mount -t cd9660 -o -e /dev/cd0 /cdrom 369.Ed 370.Pp 371causes 372.Nm 373to execute the equivalent of: 374.Bd -literal -offset indent 375/sbin/mount_cd9660 -e /dev/cd0 /cdrom 376.Ed 377.Pp 378Options that take a value are specified using the -option=value syntax: 379.Bd -literal -offset indent 380mount -t msdosfs -o -u=fred,-g=wheel /dev/da0s1 /mnt 381.Ed 382.Pp 383is equivalent to 384.Bd -literal -offset indent 385/sbin/mount_msdosfs -u fred -g wheel /dev/da0s1 /mnt 386.Ed 387.Pp 388Additional options specific to file system types 389which are not internally known 390(see the description of the 391.Fl t 392option below) 393may be described in the manual pages for the associated 394.Pa /sbin/mount_ Ns Sy XXX 395utilities. 396.It Fl p 397Print mount information in 398.Xr fstab 5 399format. 400Implies also the 401.Fl v 402option. 403.It Fl r 404The file system is to be mounted read-only. 405Mount the file system read-only (even the super-user may not write it). 406The same as the 407.Cm ro 408argument to the 409.Fl o 410option. 411.It Fl t Cm ufs | Ar external_type 412The argument following the 413.Fl t 414is used to indicate the file system type. 415The type 416.Cm ufs 417is the default. 418The 419.Fl t 420option can be used 421to indicate that the actions should only be taken on 422file systems of the specified type. 423More than one type may be specified in a comma separated list. 424The list of file system types can be prefixed with 425.Dq Li no 426to specify the file system types for which action should 427.Em not 428be taken. 429For example, the 430.Nm 431command: 432.Bd -literal -offset indent 433mount -a -t nonfs,nullfs 434.Ed 435.Pp 436mounts all file systems except those of type 437.Tn NFS 438and 439.Tn NULLFS . 440.Pp 441The default behavior of 442.Nm 443is to pass the 444.Fl t 445option directly to the 446.Xr nmount 2 447system call in the 448.Li fstype 449option. 450.Pp 451However, for the following file system types: 452.Cm cd9660 , 453.Cm mfs , 454.Cm msdosfs , 455.Cm nfs , 456.Cm nullfs , 457.Cm oldnfs , 458.Cm udf , 459and 460.Cm unionfs . 461.Nm 462will not call 463.Xr nmount 2 464directly and will instead attempt to execute a program in 465.Pa /sbin/mount_ Ns Sy XXX 466where 467.Sy XXX 468is replaced by the file system type name. 469For example, nfs file systems are mounted by the program 470.Pa /sbin/mount_nfs . 471.Pp 472Most file systems will be dynamically loaded by the kernel 473if not already present, and if the kernel module is available. 474.It Fl u 475The 476.Fl u 477flag indicates that the status of an already mounted file 478system should be changed. 479Any of the options discussed above (the 480.Fl o 481option) 482may be changed; 483also a file system can be changed from read-only to read-write 484or vice versa. 485An attempt to change from read-write to read-only will fail if any 486files on the file system are currently open for writing unless the 487.Fl f 488flag is also specified. 489The set of options is determined by applying the options specified 490in the argument to 491.Fl o 492and finally applying the 493.Fl r 494or 495.Fl w 496option. 497.It Fl v 498Verbose mode. 499If the 500.Fl v 501is used alone, show all file systems, including those that were mounted with the 502.Dv MNT_IGNORE 503flag and show additional information about each file system (including fsid 504when run by root). 505.It Fl w 506The file system object is to be read and write. 507.El 508.Sh ENVIRONMENT 509.Bl -tag -width ".Ev PATH_FSTAB" 510.It Ev PATH_FSTAB 511If the environment variable 512.Ev PATH_FSTAB 513is set, all operations are performed against the specified file. 514.Ev PATH_FSTAB 515will not be honored if the process environment or memory address space is 516considered 517.Dq tainted . 518(See 519.Xr issetugid 2 520for more information.) 521.El 522.Sh FILES 523.Bl -tag -width /etc/fstab -compact 524.It Pa /etc/fstab 525file system table 526.El 527.Sh DIAGNOSTICS 528Various, most of them are self-explanatory. 529.Pp 530.Dl XXXXX file system is not available 531.Pp 532The kernel does not support the respective file system type. 533Note that 534support for a particular file system might be provided either on a static 535(kernel compile-time), or dynamic basis (loaded as a kernel module by 536.Xr kldload 8 ) . 537.Sh SEE ALSO 538.Xr getfacl 1 , 539.Xr setfacl 1 , 540.Xr nmount 2 , 541.Xr acl 3 , 542.Xr mac 4 , 543.Xr devfs 5 , 544.Xr ext2fs 5 , 545.Xr fstab 5 , 546.Xr procfs 5 , 547.Xr kldload 8 , 548.Xr mount_cd9660 8 , 549.Xr mount_msdosfs 8 , 550.Xr mount_nfs 8 , 551.Xr mount_nullfs 8 , 552.Xr mount_udf 8 , 553.Xr mount_unionfs 8 , 554.Xr umount 8 , 555.Xr zfs 8 , 556.Xr zpool 8 557.Sh HISTORY 558A 559.Nm 560utility appeared in 561.At v1 . 562.Sh CAVEATS 563After a successful 564.Nm , 565the permissions on the original mount point determine if 566.Pa ..\& 567is accessible from the mounted file system. 568The minimum permissions for 569the mount point for traversal across the mount point in both 570directions to be possible for all users is 0111 (execute for all). 571.Pp 572Use of the 573.Nm 574is preferred over the use of the file system specific 575.Pa mount_ Ns Sy XXX 576commands. 577In particular, 578.Xr mountd 8 579gets a 580.Dv SIGHUP 581signal (that causes an update of the export list) 582only when the file system is mounted via 583.Nm . 584.Sh BUGS 585It is possible for a corrupted file system to cause a crash. 586