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.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)mount.8 8.8 (Berkeley) 6/16/94 33.\" $FreeBSD$ 34.\" 35.Dd June 16, 1994 36.Dt MOUNT 8 37.Os 38.Sh NAME 39.Nm mount 40.Nd mount filesystems 41.Sh SYNOPSIS 42.Nm 43.Op Fl adfpruvw 44.Op Fl t Ar ufs | external_type 45.Nm 46.Op Fl dfpruvw 47.Ar special | node 48.Nm 49.Op Fl dfpruvw 50.Op Fl o Ar options 51.Op Fl t Ar ufs | external_type 52.Ar special node 53.Sh DESCRIPTION 54The 55.Nm 56utility calls the 57.Xr mount 2 58system call to prepare and graft a 59.Ar "special device" 60or the remote node (rhost:path) on to the filesystem tree at the point 61.Ar node . 62If either 63.Ar special 64or 65.Ar node 66are not provided, the appropriate information is taken from the 67.Xr fstab 5 68file. 69.Pp 70The system maintains a list of currently mounted filesystems. 71If no arguments are given to 72.Nm , 73this list is printed. 74.Pp 75The options are as follows: 76.Bl -tag -width indent 77.It Fl a 78All the filesystems described in 79.Xr fstab 5 80are mounted. 81Exceptions are those marked as 82.Dq noauto , 83excluded by the 84.Fl t 85flag (see below), or if they are already mounted (except the 86root filesystem which is always remounted to preserve 87traditional single user mode behavior). 88.It Fl d 89Causes everything to be done except for the actual system call. 90This option is useful in conjunction with the 91.Fl v 92flag to 93determine what the 94.Nm 95command is trying to do. 96.It Fl f 97Forces the revocation of write access when trying to downgrade 98a filesystem mount status from read-write to read-only. 99Also 100forces the R/W mount of an unclean filesystem (dangerous; use with 101caution). 102.It Fl o 103Options are specified with a 104.Fl o 105flag followed by a comma separated string of options. 106In case of conflicting options being specified, the rightmost option 107takes effect. 108The following options are available: 109.Bl -tag -width indent 110.It Cm async 111All 112.Tn I/O 113to the filesystem should be done asynchronously. 114This is a 115.Em dangerous 116flag to set, 117and should not be used unless you are prepared to recreate the file 118system should your system crash. 119.It Cm current 120When used with the 121.Fl u 122flag, this is the same as specifying the options currently in effect for 123the mounted filesystem. 124.It Cm force 125The same as 126.Fl f ; 127forces the revocation of write access when trying to downgrade 128a filesystem mount status from read-write to read-only. 129Also 130forces the R/W mount of an unclean filesystem (dangerous; use with caution). 131.It Cm fstab 132When used with the 133.Fl u 134flag, this is the same as specifying all the options listed in the 135.Xr fstab 5 136file for the filesystem. 137.It Cm noasync 138Metadata I/O should be done synchronously, while data I/O should be done 139asynchronously. 140This is the default. 141.It Cm noatime 142Do not update the file access time when reading from a file. 143This option 144is useful on filesystems where there are large numbers of files and 145performance is more critical than updating the file access time (which is 146rarely ever important). 147This option is currently only supported on local filesystems. 148.It Cm noauto 149This filesystem should be skipped when 150.Nm 151is run with the 152.Fl a 153flag. 154.It Cm noclusterr 155Disable read clustering. 156.It Cm noclusterw 157Disable write clustering. 158.It Cm nodev 159Do not interpret character or block special devices on the filesystem. 160This option is useful for a server that has filesystems containing 161special devices for architectures other than its own. 162.It Cm noexec 163Do not allow execution of any binaries on the mounted filesystem. 164This option is useful for a server that has filesystems containing 165binaries for architectures other than its own. 166.It Cm nosuid 167Do not allow set-user-identifier or set-group-identifier bits to take effect. 168Note: this option is worthless if a public available suid or sgid 169wrapper like 170.Xr suidperl 1 171is installed on your system. 172.It Cm nosymfollow 173Do not follow symlinks 174on the mounted filesystem. 175.It Cm rdonly 176The same as 177.Fl r ; 178mount the filesystem read-only (even the super-user may not write it). 179.It Cm sync 180All 181.Tn I/O 182to the filesystem should be done synchronously. 183.It Cm snapshot 184This option allows a snapshot of the specified filesystem to be taken. 185The 186.Fl u 187flag is required with this option. 188Note that snapshot files must be created in the filesystem that is being 189snapshotted. 190You may create up to 20 snapshots per filesystem. 191Active snapshots are recorded in the superblock, so they persist across unmount 192and remount operations and across system reboots. 193When you are done with a snapshot, it can be removed with the 194.Xr rm 195command. 196Snapshots may be removed in any order, however you may not get back all the 197space contained in the snapshot as another snapshot may claim some of the blocks 198that it is releasing. 199Note that the schg flag is set on snapshots to ensure that not even the root 200user can write to them. 201The unlink command makes an exception for snapshot files in that it allows them 202to be removed even though they have the schg flag set, so it is not necessary to 203clear the schg flag before removing a snapshot file. 204.Pp 205Once you have taken a snapshot, there are three interesting things that you can 206do with it: 207.Pp 208.Bl -enum -compact 209.It 210Run fsck on the snapshot file. 211Assuming that the filesystem was clean when it was mounted, you should always 212get a clean (and unchanging) result from running fsck on the snapshot. 213This is essentially what the background fsck process does. 214.Pp 215.It 216Run dump on the snapshot. 217You will get a dump that is consistent with the filesystem as of the timestamp 218of the snapshot. 219Note that 220.Xr dump 221has not yet been changed to set the dumpdates file correctly, so do not use this 222feature in production until that fix is made. 223.Pp 224.It 225Mount the snapshot as a frozen image of the filesystem. 226To mount the snapshot 227.Pa /var/snapshot/snap1 : 228.Bd -literal 229mdconfig -a -t vnode -f /var/snapshot/snap1 -u 4 230mount -r /dev/md4 /mnt 231.Ed 232.Pp 233You can now cruise around your frozen 234.Pa /var 235filesystem at 236.Pa /mnt . 237Everything will be in the same state that it was at the time the snapshot was 238taken. 239The one exception is that any earlier snapshots will appear as zero length 240files. 241When you are done with the mounted snapshot: 242.Bd -literal 243umount /mnt 244mdconfig -d -u 4 245.Ed 246.Pp 247Further details can be found in the file at 248.Pa /usr/src/sys/ufs/ffs/README.snapshot . 249.El 250.It Cm suiddir 251A directory on the mounted filesystem will respond to the SUID bit 252being set, by setting the owner of any new files to be the same 253as the owner of the directory. 254New directories will inherit the bit from their parents. 255Execute bits are removed from 256the file, and it will not be given to root. 257.Pp 258This feature is designed for use on fileservers serving PC users via 259ftp, SAMBA, or netatalk. 260It provides security holes for shell users and as 261such should not be used on shell machines, especially on home directories. 262This option requires the SUIDDIR 263option in the kernel to work. 264Only UFS filesystems support this option. 265See 266.Xr chmod 2 267for more information. 268.It Cm update 269The same as 270.Fl u ; 271indicate that the status of an already mounted filesystem should be changed. 272.It Cm union 273Causes the namespace at the mount point to appear as the union 274of the mounted filesystem root and the existing directory. 275Lookups will be done in the mounted filesystem first. 276If those operations fail due to a non-existent file the underlying 277directory is then accessed. 278All creates are done in the mounted filesystem. 279.El 280.Pp 281Any additional options specific to a filesystem type that is not 282one of the internally known types (see the 283.Fl t 284option) may be passed as a comma separated list; these options are 285distinguished by a leading 286.Dq \&- 287(dash). 288Options that take a value are specified using the syntax -option=value. 289For example, the 290.Nm 291command: 292.Bd -literal -offset indent 293mount -t unionfs -o -b /sys $HOME/sys 294.Ed 295.Pp 296causes 297.Nm 298to execute the equivalent of: 299.Bd -literal -offset indent 300/sbin/mount_unionfs -b /sys $HOME/sys 301.Ed 302.Pp 303Additional options specific to filesystem types 304which are not internally known 305(see the description of the 306.Fl t 307option below) 308may be described in the manual pages for the associated 309.Pa /sbin/mount_ Ns Sy XXX 310utilities. 311.It Fl p 312Print mount information in 313.Xr fstab 5 314format. 315Implies also the 316.Fl v 317option. 318.It Fl r 319The filesystem is to be mounted read-only. 320Mount the filesystem read-only (even the super-user may not write it). 321The same as the 322.Cm rdonly 323argument to the 324.Fl o 325option. 326.It Fl t Ar ufs | external_type 327The argument following the 328.Fl t 329is used to indicate the filesystem type. 330The type 331.Ar ufs 332is the default. 333The 334.Fl t 335option can be used 336to indicate that the actions should only be taken on 337filesystems of the specified type. 338More than one type may be specified in a comma separated list. 339The list of filesystem types can be prefixed with 340.Dq no 341to specify the filesystem types for which action should 342.Em not 343be taken. 344For example, the 345.Nm 346command: 347.Bd -literal -offset indent 348mount -a -t nonfs,nullfs 349.Ed 350.Pp 351mounts all filesystems except those of type 352.Tn NFS 353and 354.Tn NULLFS . 355.Pp 356If the type is not one of the internally known types, 357.Nm 358will attempt to execute a program in 359.Pa /sbin/mount_ Ns Sy XXX 360where 361.Sy XXX 362is replaced by the type name. 363For example, nfs filesystems are mounted by the program 364.Pa /sbin/mount_nfs . 365.Pp 366Most filesystems will be dynamically loaded by their 367.Nm 368programs 369if not already present in the kernel, using the 370.Xr vfsload 3 371subroutine. 372Because this mechanism requires writable temporary space, 373the filesystem type containing 374.Pa /tmp 375must be compiled into the kernel, and the filesystems containing 376.Pa /tmp 377and 378.Pa /usr/bin/ld 379must be listed in 380.Pa /etc/fstab 381before any filesystems which might be dynamically loaded. 382.It Fl u 383The 384.Fl u 385flag indicates that the status of an already mounted file 386system should be changed. 387Any of the options discussed above (the 388.Fl o 389option) 390may be changed; 391also a filesystem can be changed from read-only to read-write 392or vice versa. 393An attempt to change from read-write to read-only will fail if any 394files on the filesystem are currently open for writing unless the 395.Fl f 396flag is also specified. 397The set of options is determined by applying the options specified 398in the argument to 399.Fl o 400and finally applying the 401.Fl r 402or 403.Fl w 404option. 405.It Fl v 406Verbose mode. 407.It Fl w 408The filesystem object is to be read and write. 409.El 410.Sh DIAGNOSTICS 411Various, most of them are self-explanatory. 412.Pp 413.Dl XXXXX filesystem is not available 414.Pp 415The kernel does not support the respective filesystem type. 416Note that 417support for a particular filesystem might be provided either on a static 418(kernel compile-time), or dynamic basis (loaded as a kernel module by 419.Xr kldload 8 ) . 420Normally, 421.Nm 422or its subprocesses attempt to dynamically load a filesystem module if 423it has not been configured statically, using 424.Xr vfsload 3 . 425In this case, the above error message can also mean that you did not 426have permission to load the module. 427.Sh FILES 428.Bl -tag -width /etc/fstab -compact 429.It Pa /etc/fstab 430filesystem table 431.El 432.Sh SEE ALSO 433.Xr mount 2 , 434.Xr vfsload 3 , 435.Xr fstab 5 , 436.Xr kldload 8 , 437.Xr mount_cd9660 8 , 438.Xr mount_devfs 8 , 439.Xr mount_ext2fs 8 , 440.Xr mount_fdescfs 8 , 441.Xr mount_hpfs 8 , 442.Xr mount_linprocfs 8 , 443.Xr mount_msdosfs 8 , 444.Xr mount_nfs 8 , 445.Xr mount_ntfs 8 , 446.Xr mount_nullfs 8 , 447.Xr mount_nwfs 8 , 448.Xr mount_portalfs 8 , 449.Xr mount_procfs 8 , 450.Xr mount_smbfs 8 , 451.Xr mount_std 8 , 452.Xr mount_udf 8 , 453.Xr mount_umapfs 8 , 454.Xr mount_unionfs 8 , 455.Xr umount 8 456.Sh BUGS 457It is possible for a corrupted filesystem to cause a crash. 458.Sh CAVEATS 459After a successful 460.Nm , 461the permissions on the original mount point determine if 462.Pa ..\& 463is accessible from the mounted filesystem. 464The minimum permissions for 465the mount point for traversal across the mount point in both 466directions to be possible for all users is 0111 (execute for all). 467.Sh HISTORY 468A 469.Nm 470utility appeared in 471.At v1 . 472