]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/umount.8.adoc
Merge branch 'xry111/pidfs' of https://github.com/xry111/util-linux
[thirdparty/util-linux.git] / sys-utils / umount.8.adoc
CommitLineData
295b3979 1//po4a: entry man manual
b9d2ddfb
MB
2////
3Copyright (c) 1996 Andries Brouwer
4This page is somewhat derived from a page that was
5(c) 1980, 1989, 1991 The Regents of the University of California
6and had been heavily modified by Rik Faith and myself.
7
8This is free documentation; you can redistribute it and/or
9modify it under the terms of the GNU General Public License as
10published by the Free Software Foundation; either version 2 of
11the License, or (at your option) any later version.
12
13The GNU General Public License's references to "object code"
14and "executables" are to be interpreted as the output of any
15document formatting or typesetting system, including
16intermediate and printed output.
17
18This manual is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License along
24with this program; if not, write to the Free Software Foundation, Inc.,
2551 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26////
27= umount(8)
28:doctype: manpage
29:man manual: System Administration
30:man source: util-linux {release-version}
31:page-layout: base
32:command: umount
33
34== NAME
35
36umount - unmount filesystems
37
38== SYNOPSIS
39
40*umount* *-a* [*-dflnrv*] [*-t* _fstype_] [*-O* _option_...]
41
42*umount* [*-dflnrv*] {_directory_|_device_}
43
44*umount* *-h*|*-V*
45
46== DESCRIPTION
47
48The *umount* command detaches the mentioned filesystem(s) from the file hierarchy. A filesystem is specified by giving the directory where it has been mounted. Giving the special device on which the filesystem lives may also work, but is obsolete, mainly because it will fail in case this device was mounted on more than one directory.
49
50Note that a filesystem cannot be unmounted when it is 'busy' - for example, when there are open files on it, or when some process has its working directory there, or when a swap file on it is in use. The offending process could even be *umount* itself - it opens libc, and libc in its turn may open for example locale files. A lazy unmount avoids this problem, but it may introduce other issues. See *--lazy* description below.
51
52== OPTIONS
53
54*-a*, *--all*::
4eab78d3 55All of the filesystems described in _/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 *--types* umount option.
b9d2ddfb
MB
56
57*-A*, *--all-targets*::
4eab78d3 58Unmount 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 *--recursive*, 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_.
b9d2ddfb
MB
59
60*-c*, *--no-canonicalize*::
4eab78d3
MB
61Do not canonicalize paths. The paths canonicalization is based on *stat*(2) and *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.
62+
63This option is silently ignored by *umount* for non-root users.
64+
65For more details about this option see the *mount*(8) man page. Note that *umount* does not pass this option to the **/sbin/umount.**__type__ helpers.
b9d2ddfb
MB
66
67*-d*, *--detach-loop*::
4eab78d3 68When the unmounted device was a loop device, also free this loop device. This option is unnecessary for devices initialized by *mount*(8), in this case "autoclear" functionality is enabled by default.
b9d2ddfb
MB
69
70*--fake*::
4eab78d3 71Causes 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 _/etc/mtab_ that were unmounted earlier with the *-n* option.
b9d2ddfb
MB
72
73*-f*, *--force*::
4eab78d3
MB
74Force an unmount (in case of an unreachable NFS system).
75+
e6743239 76Note 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*(2) and *stat*(2) system calls on unreachable NFS in *umount*.
b9d2ddfb
MB
77
78*-i*, *--internal-only*::
4eab78d3 79Do not call the **/sbin/umount.**__filesystem__ helper even if it exists. By default such a helper program is called if it exists.
b9d2ddfb
MB
80
81*-l*, *--lazy*::
4eab78d3
MB
82Lazy 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.
83+
e6743239 84A 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 *umount -l* 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.
b9d2ddfb
MB
85
86*-N*, *--namespace* _ns_::
e6743239 87Perform *umount* in the mount namespace specified by _ns_. _ns_ is either PID of process running in that namespace or special file representing that namespace.
4eab78d3
MB
88+
89*umount* switches to the namespace when it reads _/etc/fstab_, writes _/etc/mtab_ (or writes to _/run/mount_) and calls *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 other requirements necessary to execute *umount*(2) command.
90+
91See *mount_namespaces*(7) for more information.
b9d2ddfb
MB
92
93*-n*, *--no-mtab*::
4eab78d3 94Unmount without writing in _/etc/mtab_.
b9d2ddfb
MB
95
96*-O*, *--test-opts* _option_...::
4eab78d3 97Unmount only the filesystems that have the specified option set in _/etc/fstab_. More than one option may be specified in a comma-separated list. Each option can be prefixed with *no* to indicate that no action should be taken for this option.
b9d2ddfb
MB
98
99*-q*, *--quiet*::
4eab78d3 100Suppress "not mounted" error messages.
b9d2ddfb
MB
101
102*-R*, *--recursive*::
4eab78d3 103Recursively 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. Since version 2.37 it umounts also all over-mounted filesystems (more filesystems on the same mountpoint).
b9d2ddfb
MB
104
105*-r*, *--read-only*::
4eab78d3 106When an unmount fails, try to remount the filesystem read-only.
b9d2ddfb
MB
107
108*-t*, *--types* _type_...::
4eab78d3 109Indicate that the actions should only be taken on filesystems of the specified _type_. More than one type may be specified in a comma-separated list. The list of filesystem types can be prefixed with *no* to indicate that no action should be taken for all of the mentioned types. Note that *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").
b9d2ddfb
MB
110
111*-v*, *--verbose*::
4eab78d3 112Verbose mode.
b9d2ddfb 113
2b2d3172 114include::man-common/help-version.adoc[]
b9d2ddfb
MB
115
116== NON-SUPERUSER UMOUNTS
117
118Normally, only the superuser can umount filesystems. However, when _fstab_ contains the *user* option on a line, anybody can umount the corresponding filesystem. For more details see *mount*(8) man page.
119
e6743239 120Since version 2.34 the *umount* command can be used 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.
b9d2ddfb 121
bd67ca44 122Since version 2.35 *umount* 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. This can be used to support use-cases where root permissions are not necessary (e.g., fuse filesystems, user namespaces, etc).
b9d2ddfb
MB
123
124== LOOP DEVICE
125
126The *umount* command will automatically detach loop device previously initialized by *mount*(8) command independently of _/etc/mtab_.
127
bd67ca44 128In this case the device is initialized with "autoclear" flag (see *losetup*(8) output for more details), otherwise it's necessary to use the option *--detach-loop* or call *losetup -d* _device_. The autoclear feature is supported since Linux 2.6.25.
b9d2ddfb
MB
129
130== EXTERNAL HELPERS
131
132The syntax of external unmount helpers is:
133
134____
135**umount.**__suffix__ {__directory__|_device_} [*-flnrv*] [*-N* _namespace_] [*-t* _type_._subtype_]
136____
137
138where _suffix_ is the filesystem type (or the value from a *uhelper=* or *helper=* marker in the mtab file). The *-t* option can be used for filesystems that have subtype support. For example:
139
140____
141*umount.fuse -t fuse.sshfs*
142____
143
144A **uhelper=**__something__ marker (unprivileged helper) can appear in the _/etc/mtab_ file when ordinary users need to be able to unmount a mountpoint that is not defined in _/etc/fstab_ (for example for a device that was mounted by *udisks*(1)).
145
bd67ca44 146A **helper=**__type__ marker in the _mtab_ file will redirect all unmount requests to the **/sbin/umount.**__type__ helper independently of UID.
b9d2ddfb 147
bd67ca44 148Note that _/etc/mtab_ is currently deprecated and *helper=* and other userspace mount options are maintained by *libmount*.
b9d2ddfb
MB
149
150== ENVIRONMENT
151
e6743239
MB
152*LIBMOUNT_FSTAB*=<path>::
153overrides the default location of the _fstab_ file (ignored for *suid*)
b9d2ddfb 154
e6743239 155*LIBMOUNT_DEBUG*=all::
4eab78d3 156enables *libmount* debug output
b9d2ddfb
MB
157
158== FILES
159
160_/etc/mtab_::
4eab78d3 161table of mounted filesystems (deprecated and usually replaced by symlink to _/proc/mounts_)
b9d2ddfb
MB
162
163_/etc/fstab_::
4eab78d3 164table of known filesystems
b9d2ddfb
MB
165
166_/proc/self/mountinfo_::
4eab78d3 167table of mounted filesystems generated by kernel.
b9d2ddfb
MB
168
169== HISTORY
170
171A *umount* command appeared in Version 6 AT&T UNIX.
172
173== SEE ALSO
174
175*umount*(2),
176*losetup*(8),
177*mount_namespaces*(7),
178*mount*(8)
179
625e9c61 180include::man-common/bugreports.adoc[]
b9d2ddfb 181
625e9c61 182include::man-common/footer.adoc[]
b9d2ddfb
MB
183
184ifdef::translation[]
625e9c61 185include::man-common/translation.adoc[]
b9d2ddfb 186endif::[]