📄 mount.8
字号:
.\" Copyright (c) 1996 Andries Brouwer.\".\" This page is somewhat derived from a page that was.\" (c) 1980, 1989, 1991 The Regents of the University of California.\" and had been heavily modified by Rik Faith and myself..\" (Probably no BSD text remains.).\" Fragments of text were written by Werner Almesberger, Remy Card,.\" Stephen Tweedie and Eric Youngdale..\".\" This is free documentation; you can redistribute it and/or.\" modify it under the terms of the GNU General Public License as.\" published by the Free Software Foundation; either version 2 of.\" the License, or (at your option) any later version..\".\" The GNU General Public License's references to "object code".\" and "executables" are to be interpreted as the output of any.\" document formatting or typesetting system, including.\" intermediate and printed output..\".\" This manual is distributed in the hope that it will be useful,.\" but WITHOUT ANY WARRANTY; without even the implied warranty of.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the.\" GNU General Public License for more details..\".\" You should have received a copy of the GNU General Public.\" License along with this manual; if not, write to the Free.\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,.\" USA..\".\" 960705, aeb: version for mount-2.7g.\" 970114, aeb: xiafs and ext are dead; romfs is new.\" 970623, aeb: -F option.\" 970914, reg: -s option.\" 981111, K.Garloff: /etc/filesystems.\" 990111, aeb: documented /sbin/mount.smbfs.\" 990730, Yann Droneaud <lch@multimania.com>: updated page.\" 991214, Elrond <Elrond@Wunder-Nett.org>: added some docs on devpts.\" 010714, Michael K. Johnson <johnsonm@redhat.com> added -O.\" 010725, Nikita Danilov <NikitaDanilov@Yahoo.COM>: reiserfs options.\" 011124, Karl Eichwalder <ke@gnu.franken.de>: tmpfs options.\".TH MOUNT 8 "14 September 1997" "Linux 2.0" "Linux Programmer's Manual".SH NAMEmount \- mount a file system.SH SYNOPSIS.BI "mount [\-lhV]".LP.BI "mount \-a [\-fFnrsvw] [\-t " vfstype "] [\-O " optlist ].br.BI "mount [\-fnrsvw] [\-o " options " [,...]] " "device " | " dir".br.BI "mount [\-fnrsvw] [\-t " vfstype "] [\-o " options "] " "device dir".SH DESCRIPTIONAll files accessible in a Unix system are arranged in one bigtree, the file hierarchy, rooted at.BR / .These files can be spread out over several devices. The.B mountcommand serves to attach the file system found on some deviceto the big file tree. Conversely, the.BR umount (8)command will detach it again.The standard form of the.B mountcommand, is.RS.br.BI "mount \-t" " type device dir".REThis tells the kernel to attach the file system found on.I device(which is of type.IR type )at the directory.IR dir .The previous contents (if any) and owner and mode of.I dirbecome invisible, and as long as this file system remains mounted,the pathname.I dirrefers to the root of the file system on.IR device .Three forms of invocation do not actually mount anything:.RS.br.B "mount \-h".REprints a help message;.RS.br.B "mount \-V".REprints a version string; and just.RS.BI "mount [-l] [-t" " type" ].RElists all mounted file systems (of type.IR type ).The option \-l adds the (ext2, ext3 and XFS) labels in this listing.See below..\" In fact since 2.3.99. At first the syntax was mount -t bind.Since Linux 2.4.0 it is possible to remount part of thefile hierarchy somewhere else. The call is.RS.br.B "mount --bind olddir newdir".REAfter this call the same contents is accessible in two places.One can also remount a single file (on a single file).This call attaches only (part of) a single filesystem, not possiblesubmounts. The entire file hierarchy including submounts is attacheda second place using.RS.br.B "mount --rbind olddir newdir".RE.\" available since Linux 2.4.11.The mount options are not changed.Since Linux 2.5.1 it is possible to atomically move a mounted treeto another place. The call is.RS.br.B "mount --move olddir newdir".REThe.I procfile system is not associated with a special device, and whenmounting it, an arbitrary keyword, such as.I proccan be used instead of a device specification.(The customary choice.I noneis less fortunate: the error message `none busy' from.B umountcan be confusing.)Most devices are indicated by a file name (of a block special device), like.IR /dev/sda1 ,but there are other possibilities. For example, in the case of an NFS mount,.I devicemay look like.IR knuth.cwi.nl:/dir .It is possible to indicate a block special device using itsvolume label or UUID (see the \-L and \-U options below).The file.I /etc/fstab(see.BR fstab (5)),may contain lines describing what devices are usuallymounted where, using which options. This file is used in three ways:.LP(i) The command.RS.br.BI "mount \-a [\-t " type "] [\-O " optlist ].RE(usually given in a bootscript) causes all file systems mentioned in.I fstab(of the proper type and/or having or not having the proper options)to be mounted as indicated, except for those whose line contains the.B noautokeyword. Adding the.B \-Foption will make mount fork, so that thefilesystems are mounted simultaneously..LP(ii) When mounting a file system mentioned in.IR fstab ,it suffices to give only the device, or only the mount point..LP(iii) Normally, only the superuser can mount file systems.However, when.I fstabcontains the.B useroption on a line, then anybody can mount the corresponding system..LPThus, given a line.RS.br.B "/dev/cdrom /cd iso9660 ro,user,noauto,unhide".REany user can mount the iso9660 file system found on his CDROMusing the command.RS.br.B "mount /dev/cdrom".REor.RS.br.B "mount /cd".REFor more details, see.BR fstab (5).Only the user that mounted a filesystem can unmount it again.If any user should be able to unmount, then use.B usersinstead of.B userin the.I fstabline.The.B owneroption is similar to the.B useroption, with the restriction that the user must be the ownerof the special file. This may be useful e.g. for.I /dev/fdif a login script makes the console user owner of this device.The.B groupoption is similar, with the restriction that the user must bemember of the group of the special file.The programs.B mountand.B umountmaintain a list of currently mounted file systems in the file.IR /etc/mtab .If no arguments are given to.BR mount ,this list is printed.When the.I procfilesystem is mounted (say at.IR /proc ),the files.I /etc/mtaband.I /proc/mountshave very similar contents. The former has somewhatmore information, such as the mount options used,but is not necessarily up-to-date (cf. the.B \-noption below). It is possible to replace.I /etc/mtabby a symbolic link to.IR /proc/mounts ,and especially when you have very large numbers of mountsthings will be much faster with that symlink,but some information is lost that way, and in particularworking with the loop device will be less convenient,and using the "user" option will fail..SH OPTIONSThe full set of options used by an invocation of.B mountis determined by first extracting theoptions for the file system from the.I fstabtable, then applying any options specified by the.B \-oargument, and finally applying a.BR \-r " or " \-woption, when present.Options available for the.B mountcommand:.TP.B \-VOutput version..TP.B \-hPrint a help message..TP.B \-vVerbose mode..TP.B \-aMount all filesystems (of the given types) mentioned in.IR fstab ..TP.B \-F(Used in conjunction with.BR \-a .)Fork off a new incarnation of mount for each device.This will do the mounts on different devices or different NFS serversin parallel.This has the advantage that it is faster; also NFS timeouts go inparallel. A disadvantage is that the mounts are done in undefined order.Thus, you cannot use this option if you want to mount both.I /usrand.IR /usr/spool ..TP.B \-fCauses everything to be done except for the actual system call; if it's notobvious, this ``fakes'' mounting the file system. This option is useful inconjunction with the.B \-vflag to determine what the.B mountcommand is trying to do. It can also be used to add entries for devicesthat were mounted earlier with the -n option..TP.B \-iDon't call the /sbin/mount.<filesystem> helper even if it exists..TP.B \-lAdd the ext2, ext3 and XFS labels in the mount output. Mount must havepermission to read the disk device (e.g. be suid root) for this to work.One can set such a label for ext2 or ext3 using the.BR e2label (8)utility, or for XFS using.BR xfs_admin (8)..TP.B \-nMount without writing in.IR /etc/mtab .This is necessary for example when.I /etcis on a read-only file system..TP.BI \-p " num"In case of a loop mount with encryption, read the passphrase fromfile descriptor.I numinstead of from the terminal..TP.B \-sTolerate sloppy mount options rather than failing. This will ignoremount options not supported by a filesystem type. Not all filesystemssupport this option. This option exists for support of the Linuxautofs\-based automounter..TP.B \-rMount the file system read-only. A synonym is.BR "\-o ro" ..TP.B \-wMount the file system read/write. This is the default. A synonym is.BR "\-o rw" ..TP.BI \-L " label"Mount the partition that has the specified.IR label ..TP.BI \-U " uuid"Mount the partition that has the specified.IR uuid .These two options require the file.I /proc/partitions(present since Linux 2.1.116) to exist..TP.BI \-t " vfstype"The argument following the.B \-tis used to indicate the file system type. The file system types which arecurrently supported are:.IR adfs ,.IR affs ,.IR autofs ,.IR coda ,.IR coherent ,.IR cramfs ,.IR devpts ,.IR efs ,.IR ext ,.IR ext2 ,.IR ext3 ,.IR hfs ,.IR hpfs ,.IR iso9660 ,.IR jfs ,.IR minix ,.IR msdos ,.IR ncpfs ,.IR nfs ,.IR ntfs ,.IR proc ,.IR qnx4 ,.IR ramfs ,.IR reiserfs ,.IR romfs ,.IR smbfs ,.IR sysv ,.IR tmpfs ,.IR udf ,.IR ufs ,.IR umsdos ,.IR usbfs ,.IR vfat ,.IR xenix ,.IR xfs ,.IR xiafs .Note that coherent, sysv and xenix are equivalent and that.I xenixand.I coherentwill be removed at some point in the future \(em use.I sysvinstead. Since kernel version 2.1.21 the types.I extand.I xiafsdo not exist anymore. Earlier,.I usbfswas known as.IR usbdevfs .For most types all the.B mountprogram has to do is issue a simple.IR mount (2)system call, and no detailed knowledge of the filesystem type is required.For a few types however (like nfs, smbfs, ncpfs) ad hoc code isnecessary. The nfs ad hoc code is built in, but smbfs and ncpfshave a separate mount program. In order to make it possible totreat all types in a uniform way, mount will execute the program.I /sbin/mount.TYPE(if that exists) when called with type.IR TYPE .Since various versions of the.I smbmountprogram have different calling conventions,.I /sbin/mount.smbfsmay have to be a shell script that sets up the desired call.If no.B \-toption is given, or if the.B autotype is specified, mount will try to guess the desired type.If mount was compiled with the blkid library, the guessing is doneby this library. Otherwise, mount guesses itself by probing thesuperblock; if that does not turn up anything that looks familiar,mount will try to read the file.IR /etc/filesystems ,or, if that does not exist,.IR /proc/filesystems .All of the filesystem types listed there will be tried,except for those that are labeled "nodev" (e.g.,.IR devpts ,.I procand.IR nfs ).If.I /etc/filesystemsends in a line with a single * only, mount will read.I /proc/filesystemsafterwards.The.B autotype may be useful for user-mounted floppies.Creating a file.I /etc/filesystemscan be useful to change the probe order (e.g., to try vfat before msdosor ext3 before ext2) or if you use a kernel module autoloader.Warning: the probing uses a heuristic (the presence of appropriate `magic'),and could recognize the wrong filesystem type, possibly with catastrophicconsequences. If your data is valuable, don't ask.B mountto guess.More than one type may be specified in a comma separatedlist. The list of file system types can be prefixed with.B noto specify the file system types on which no action should be taken.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -