1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
.\" 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.
.\"
.\" 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 program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.TH UMOUNT 8 "July 2014" "util-linux" "System Administration"
.SH NAME
umount \- unmount file systems
.SH SYNOPSIS
.B umount \-a
.RB [ \-dflnrv ]
.RB [ \-t
.IR fstype ]
.RB [ \-O
.IR option ...]
.sp
.B umount
.RB [ \-dflnrv ]
.RI { directory | device }...
.sp
.B umount
.BR \-h | \-V
.SH DESCRIPTION
The
.B umount
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
device was mounted on more than one directory.
.PP
Note that a file system 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
.B 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 another
issues. See \fB\-\-lazy\fR description below.
.SH OPTIONS
.TP
.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 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
.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. Note that \fBumount\fR does not pass this option to the
.BI /sbin/umount. type
helpers.
.TP
.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
.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
.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
.BR \-N , " \-\-namespace " \fIns
Perform umount in 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 namespace does not have
to contain any libraries or another requirements necessary to execute
.BR umount (2)
command.
.sp
See \fBnamespaces\fR(7) for more information.
.TP
.BR \-n , " \-\-no\-mtab"
Unmount without writing in
.IR /etc/mtab .
.TP
.BR \-O , " \-\-test\-opts " \fIoption\fR...
Unmount only the filesystems that have the specified option set in
.IR /etc/fstab .
More than one option may be specified in a comma-separated list.
Each option can be prefixed with
.B no
to indicate that no action should be taken for this option.
.TP
.BR \-q , " \-\-quiet"
Suppress "not mounted" error messages.
.TP
.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
.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 filesystem types can be prefixed with
.B no
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
.BR \-v , " \-\-verbose"
Verbose mode.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.SH "LOOP DEVICE"
The
.B umount
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
.RS
.BI umount. suffix
.RI { directory | device }
.RB [ \-flnrv ]
.RB [ \-N
.IR namespace ]
.RB [ \-t
.IR type . subtype ]
.RE
.PP
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
.RS
.B umount.fuse \-t fuse.sshfs
.RE
.PP
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 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 ENVIRONMENT
.IP LIBMOUNT_FSTAB=<path>
overrides the default location of the fstab file (ignored for suid)
.IP LIBMOUNT_MTAB=<path>
overrides the default location of the mtab file (ignored for suid)
.IP LIBMOUNT_DEBUG=all
enables libmount debug output
.SH "SEE ALSO"
.BR umount (2),
.BR losetup (8),
.BR mount (8)
.SH HISTORY
A
.B umount
command appeared in Version 6 AT&T UNIX.
.SH AVAILABILITY
The umount command is part of the util-linux package and is available from
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .
|