]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - sys-utils/umount.8
Manual pages: mount.8, umount.8: Clarify that "namespace" means "mount namespace"
[thirdparty/util-linux.git] / sys-utils / umount.8
index bdd10a5295e89073395583978d5a434c0880f161..edcb6cc1f9117aa02c8f8309c3fea3e15c268b8a 100644 (file)
 .\" with this program; if not, write to the Free Software Foundation, Inc.,
 .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 .\"
-.TH UMOUNT 8 "August 2012" "util-linux" "System Administration"
+.TH UMOUNT 8 "July 2014" "util-linux" "System Administration"
 .SH NAME
 umount \- unmount file systems
 .SH SYNOPSIS
-.B umount
-.RB [ \-hV ]
-.LP
 .B umount \-a
 .RB [ \-dflnrv ]
 .RB [ \-t
-.IR vfstype ]
+.IR fstype ]
 .RB [ \-O
-.IR option]
-.br
+.IR option ...]
+.sp
 .B umount
 .RB [ \-dflnrv ]
-.RI { dir | device }...
+.RI { directory | device }...
+.sp
+.B umount
+.BR \-h | \-V
+
 .SH DESCRIPTION
 The
 .B umount
-command detaches the file system(s) mentioned from the file hierarchy.  A
+command detaches the mentioned file system(s) from the file hierarchy.  A
 file system is specified by giving the directory where it has been
 mounted.  Giving the special device on which the file system lives may
 also work, but is obsolete, mainly because it will fail in case this
@@ -54,129 +55,235 @@ working directory there, or when a swap file on it is in use.  The
 offending process could even be
 .B umount
 itself - it opens libc, and libc in its turn may open for example locale
-files.  A lazy unmount avoids this problem.
+files.  A lazy unmount avoids this problem, but it may introduce another
+issues. See \fB\-\-lazy\fR description below.
 .SH OPTIONS
 .TP
-\fB\-a\fR, \fB\-\-all\fR
-All of the file systems described in
-.I /etc/mtab
-are unmounted.  (With
-.B umount
-version 2.7 and later: the
-.I proc
-filesystem is not unmounted.)
+.BR \-a , " \-\-all"
+All of the filesystems described in
+.I /proc/self/mountinfo
+(or in deprecated /etc/mtab)
+are unmounted, except the proc, devfs, devpts, sysfs, rpc_pipefs and nfsd
+filesystems. This list of the filesystems may be replaced by \fB\-\-types\fR
+umount option.
+.TP
+.BR \-A , " \-\-all\-targets"
+Unmount all mountpoints in the current mount namespace
+for the specified filesystem.
+The filesystem can be specified by one of the mountpoints or the device name (or
+UUID, etc.).  When this option is used together with \fB\-\-recursive\fR, then
+all nested mounts within the filesystem are recursively unmounted.
+This option is only supported on systems where /etc/mtab is a symlink
+to /proc/mounts.
 .TP
-\fB\-c\fR, \fB\-\-no\-canonicalize\fR
-Do not canonicalize paths.  For more details about this option see the
+.BR \-c , " \-\-no\-canonicalize"
+Do not canonicalize paths.  The paths canonicalization is based on
+.BR stat (2)
+and
+.BR readlink (2)
+system calls. These system calls may hang in some cases (for example on NFS if
+server is not available). The option has to be used with canonical path to the
+mount point.
+
+For more details about this option see the
 .BR mount (8)
-man page.
+man page. Note that \fBumount\fR does not pass this option to the
+.BI /sbin/umount. type
+helpers.
 .TP
-\fB\-d\fR, \fB\-\-detach\-loop\fR
-In case the unmounted device was a loop device, also free this loop
-device.
+.BR \-d , " \-\-detach\-loop"
+When the unmounted device was a loop device, also free this loop
+device. This option is unnecessary for devices initialized by
+.BR mount (8),
+in this case "autoclear" functionality is enabled by default.
 .TP
-\fB\-\-fake\fP
-Causes everything to be done except for the actual system call; this 'fakes'
-unmounting the filesystem.  It can be used to remove entries from
+.B \-\-fake
+Causes everything to be done except for the actual system call or umount helper
+execution; this 'fakes' unmounting the filesystem.  It can be used to remove
+entries from the deprecated
 .I /etc/mtab
 that were unmounted earlier with the
 .B \-n
 option.
 .TP
-\fB\-f\fR, \fB\-\-force\fR
-Force unmount (in case of an unreachable NFS system).  (Requires kernel
-2.1.116 or later.)
+.BR \-f , " \-\-force"
+Force an unmount (in case of an unreachable NFS system).
+
+Note that this option does not guarantee that umount command does not hang.
+It's strongly recommended to use absolute paths without symlinks to avoid
+unwanted readlink and stat system calls on unreachable NFS in umount.
+.TP
+.BR \-i , " \-\-internal\-only"
+Do not call the \fB/sbin/umount.\fIfilesystem\fR helper even if it exists.
+By default such a helper program is called if it exists.
+.TP
+.BR \-l , " \-\-lazy"
+Lazy unmount.  Detach the filesystem from the file hierarchy now,
+and clean up all references to this filesystem as soon as it is not busy
+anymore.
+
+A system reboot would be expected in near future if you're going to use this
+option for network filesystem or local filesystem with submounts.  The
+recommended use-case for \fBumount \-l\fR is to prevent hangs on shutdown due to
+an unreachable network share where a normal umount will hang due to a downed
+server or a network partition. Remounts of the share will not be possible.
+
 .TP
-\fB\-i\fR, \fB\-\-internal\-only\fR
-Do not call the /sbin/umount.<filesystem> helper even if it exists.  By
-default /sbin/umount.<filesystem> helper is called if one exists.
+.BR \-N , " \-\-namespace " \fIns
+Perform umount in the mount namespace specified by \fIns\fR.
+\fIns\fR is either PID of process running in that namespace
+or special file representing that namespace.
+.sp
+.BR umount (8)
+switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls
+.BR umount (2)
+system call, otherwise it runs in the original namespace.
+It means that the target mount namespace does not have
+to contain any libraries or another requirements necessary to execute
+.BR umount (2)
+command.
+.sp
+See \fBmount_namespaces\fR(7) for more information.
 .TP
-\fB\-n\fR, \fB\-\-no\-mtab\fR
+.BR \-n , " \-\-no\-mtab"
 Unmount without writing in
 .IR /etc/mtab .
 .TP
-\fB\-l\fR, \fB\-\-lazy\fR
-Lazy unmount.  Detach the filesystem from the filesystem hierarchy now,
-and cleanup all references to the filesystem as soon as it is not busy
-anymore.  (Requires kernel 2.4.11 or later.)
-.TP
-\fB\-O\fR, \fB\-\-test\-opts\fR \fIoptions,list\fR
-Indicate that the actions should only be taken on file systems with the
-specified options in
+.BR \-O , " \-\-test\-opts " \fIoption\fR...
+Unmount only the filesystems that have the specified option set in
 .IR /etc/fstab .
-More than one option type may be specified in a comma separated list.
+More than one option may be specified in a comma-separated list.
 Each option can be prefixed with
 .B no
-to specify options for which no action should be taken.
+to indicate that no action should be taken for this option.
+.TP
+.BR \-q , " \-\-quiet"
+Suppress "not mounted" error messages.
 .TP
-\fB\-r\fR, \fB\-\-read\-only\fR
-In case unmounting fails, try to remount read-only.
+.BR \-R , " \-\-recursive"
+Recursively unmount each specified directory.  Recursion for each directory will
+stop if any unmount operation in the chain fails for any reason.  The relationship
+between mountpoints is determined by /proc/self/mountinfo entries.  The filesystem
+must be specified by mountpoint path; a recursive unmount by device name (or UUID)
+is unsupported.
 .TP
-\fB\-t\fR, \fB\-\-types\fR \fIvfstype,ext2,ext3\fR
-Indicate that the actions should only be taken on file systems of the
+.BR \-r , " \-\-read\-only"
+When an unmount fails, try to remount the filesystem read-only.
+.TP
+.BR \-t , " \-\-types " \fItype\fR...
+Indicate that the actions should only be taken on filesystems of the
 specified
 .IR type .
-More than one type may be specified in a comma separated list.  The list
-of file system types can be prefixed with
+More than one type may be specified in a comma-separated list.  The list
+of filesystem types can be prefixed with
 .B no
-to specify the file system types on which no action should be taken.
+to indicate that no action should be taken for all of the mentioned types.
+Note that
+.B umount
+reads information about mounted filesystems from kernel (/proc/mounts) and
+filesystem names may be different than filesystem names used in the /etc/fstab
+(e.g., "nfs4" vs. "nfs").
 .TP
-\fB\-v\fR, \fB\-\-verbose\fR
+.BR \-v , " \-\-verbose"
 Verbose mode.
 .TP
-\fB\-h\fR, \fB\-\-help\fR
-Print help message and exit.
+.BR \-V , " \-\-version"
+Display version information and exit.
 .TP
-\fB\-V\fR, \fB\-\-version\fR
-Print version and exit.
-.SH "THE LOOP DEVICE"
+.BR \-h , " \-\-help"
+Display help text and exit.
+.SH NON-SUPERUSER UMOUNTS
+Normally, only the superuser can umount filesystems.
+However, when
+.I fstab
+contains the
+.B user
+option on a line, anybody can umount the corresponding filesystem.  For more details see
+.BR mount (8)
+man page.
+.PP
+Since version 2.34 \fBumount\fR command allows to perform umount operation also
+for fuse filesystems if kernel mount table contains user's ID.  In this case fstab
+user= mount option is not required.
+.PP
+Since version 2.35 \fBumount\fR command does not exit when user permissions are
+inadequate by internal libmount security rules.  It drops suid permissions
+and continue as regular non-root user. It allows to support use-cases where
+root permissions are not necessary (e.g., fuse filesystems, user namespaces,
+etc).
+.SH LOOP DEVICE
 The
 .B umount
-command will free the loop device (if any) associated with the mount, in
-case it finds the option 'loop=...' in
-.IR /etc/mtab ,
-or when the \-d option was given.  Any pending loop devices can be freed
-using 'losetup -d', see
-.BR losetup (8).
-.SH NOTES
-The syntax of external umount helpers is:
+command will automatically detach loop device previously initialized by
+.BR mount (8)
+command independently of /etc/mtab.
+
+In this case the device is initialized with "autoclear" flag (see
+.BR losetup (8)
+output for more details), otherwise it's necessary to use the option \fB \-\-detach\-loop\fR
+or call \fBlosetup \-d <device>\fR. The autoclear feature is supported since Linux 2.6.25.
+.SH EXTERNAL HELPERS
+The syntax of external unmount helpers is:
 .PP
-.BI /sbin/umount. <suffix>
-.RI { dir | device }
-.RB [ \-nlfvr ]
+.RS
+.BI umount. suffix
+.RI { directory | device }
+.RB [ \-flnrv ]
+.RB [ \-N
+.IR namespace ]
 .RB [ \-t
-.IR type.subtype ]
+.IR type . subtype ]
+.RE
 .PP
-where the <suffix> is filesystem type or a value from "uhelper=" or
-"helper=" mtab option.  The \-t option is used for filesystems with
-subtypes support (for example /sbin/mount.fuse -t fuse.sshfs).
+where \fIsuffix\fR is the filesystem type (or the value from a
+\fBuhelper=\fR or \fBhelper=\fR marker in the mtab file).
+The \fB\-t\fR option can be used for filesystems that
+have subtype support.  For example:
 .PP
-The uhelper= (unprivileged umount helper) is possible to use when
-non-root user wants to umount a mountpoint which is not defined in the
-/etc/fstab file (e.g. devices mounted by udisk).
+.RS
+.B umount.fuse \-t fuse.sshfs
+.RE
 .PP
-The helper= mount option redirects all umount requests to the
-/sbin/umount.<helper> independently on UID.
-.SH FILES
-.I /etc/mtab
-table of mounted file systems
+A \fBuhelper=\fIsomething\fR marker (unprivileged helper) can appear in
+the \fI/etc/mtab\fR file when ordinary users need to be able to unmount
+a mountpoint that is not defined in \fI/etc/fstab\fR
+(for example for a device that was mounted by \fBudisks\fR(1)).
+.PP
+A \fBhelper=\fItype\fR marker in the mtab file will redirect
+all unmount requests
+to the \fB/sbin/umount.\fItype\fR helper independently of UID.
+.PP
+Note that \fI/etc/mtab\fR is currently deprecated and helper= and another
+userspace mount options are maintained by libmount.
 .SH ENVIRONMENT
 .IP LIBMOUNT_FSTAB=<path>
-overrides the default location of the fstab file
+overrides the default location of the fstab file (ignored for suid)
 .IP LIBMOUNT_MTAB=<path>
-overrides the default location of the mtab file
-.IP LIBMOUNT_DEBUG=0xffff
-enables debug output
-.SH "SEE ALSO"
-.BR umount (2),
-.BR mount (8),
-.BR losetup (8)
+overrides the default location of the mtab file (ignored for suid)
+.IP LIBMOUNT_DEBUG=all
+enables libmount debug output
+.SH FILES
+.TP
+.I /etc/mtab
+table of mounted filesystems (deprecated and usually replaced by
+symlink to /proc/mounts)
+.TP
+.I /etc/fstab
+table of known filesystems
+.TP
+.I /proc/self/mountinfo
+table of mounted filesystems generated by kernel.
 .SH HISTORY
 A
 .B umount
 command appeared in Version 6 AT&T UNIX.
+.SH SEE ALSO
+.BR umount (2),
+.BR losetup (8),
+.BR mount_namespaces (7)
+.BR mount (8)
 .SH AVAILABILITY
 The umount command is part of the util-linux package and is available from
-.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
+.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
 Linux Kernel Archive
 .UE .