]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/umount.8
43363b11cbbfd0f25276a9f32fc14f7a3d856e6b
[thirdparty/util-linux.git] / sys-utils / umount.8
1 .\" Copyright (c) 1996 Andries Brouwer
2 .\" This page is somewhat derived from a page that was
3 .\" (c) 1980, 1989, 1991 The Regents of the University of California
4 .\" and had been heavily modified by Rik Faith and myself.
5 .\"
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
10 .\"
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
15 .\"
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 .\" GNU General Public License for more details.
20 .\"
21 .\" You should have received a copy of the GNU General Public License along
22 .\" with this program; if not, write to the Free Software Foundation, Inc.,
23 .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 .\"
25 .TH UMOUNT 8 "July 2014" "util-linux" "System Administration"
26 .SH NAME
27 umount \- unmount file systems
28 .SH SYNOPSIS
29 .B umount \-a
30 .RB [ \-dflnrv ]
31 .RB [ \-t
32 .IR fstype ]
33 .RB [ \-O
34 .IR option ...]
35 .sp
36 .B umount
37 .RB [ \-dflnrv ]
38 .RI { directory | device }...
39 .sp
40 .B umount
41 .BR \-h | \-V
42
43 .SH DESCRIPTION
44 The
45 .B umount
46 command detaches the mentioned file system(s) from the file hierarchy. A
47 file system is specified by giving the directory where it has been
48 mounted. Giving the special device on which the file system lives may
49 also work, but is obsolete, mainly because it will fail in case this
50 device was mounted on more than one directory.
51 .PP
52 Note that a file system cannot be unmounted when it is 'busy' - for
53 example, when there are open files on it, or when some process has its
54 working directory there, or when a swap file on it is in use. The
55 offending process could even be
56 .B umount
57 itself - it opens libc, and libc in its turn may open for example locale
58 files. A lazy unmount avoids this problem, but it may introduce another
59 issues. See \fB\-\-lazy\fR description below.
60 .SH OPTIONS
61 .TP
62 .BR \-a , " \-\-all"
63 All of the filesystems described in
64 .I /proc/self/mountinfo
65 (or in deprecated /etc/mtab)
66 are unmounted, except the proc, devfs, devpts, sysfs, rpc_pipefs and nfsd
67 filesystems. This list of the filesystems may be replaced by \fB\-\-types\fR
68 umount option.
69 .TP
70 .BR \-A , " \-\-all\-targets"
71 Unmount all mountpoints in the current namespace for the specified filesystem.
72 The filesystem can be specified by one of the mountpoints or the device name (or
73 UUID, etc.). When this option is used together with \fB\-\-recursive\fR, then
74 all nested mounts within the filesystem are recursively unmounted.
75 This option is only supported on systems where /etc/mtab is a symlink
76 to /proc/mounts.
77 .TP
78 .BR \-c , " \-\-no\-canonicalize"
79 Do not canonicalize paths. The paths canonicalization is based on
80 .BR stat (2)
81 and
82 .BR readlink (2)
83 system calls. These system calls may hang in some cases (for example on NFS if
84 server is not available). The option has to be used with canonical path to the
85 mount point.
86
87 For more details about this option see the
88 .BR mount (8)
89 man page. Note that \fBumount\fR does not pass this option to the
90 .BI /sbin/umount. type
91 helpers.
92 .TP
93 .BR \-d , " \-\-detach\-loop"
94 When the unmounted device was a loop device, also free this loop
95 device. This option is unnecessary for devices initialized by
96 .BR mount (8),
97 in this case "autoclear" functionality is enabled by default.
98 .TP
99 .B \-\-fake
100 Causes everything to be done except for the actual system call or umount helper
101 execution; this 'fakes' unmounting the filesystem. It can be used to remove
102 entries from the deprecated
103 .I /etc/mtab
104 that were unmounted earlier with the
105 .B \-n
106 option.
107 .TP
108 .BR \-f , " \-\-force"
109 Force an unmount (in case of an unreachable NFS system).
110
111 Note that this option does not guarantee that umount command does not hang.
112 It's strongly recommended to use absolute paths without symlinks to avoid
113 unwanted readlink and stat system calls on unreachable NFS in umount.
114 .TP
115 .BR \-i , " \-\-internal\-only"
116 Do not call the \fB/sbin/umount.\fIfilesystem\fR helper even if it exists.
117 By default such a helper program is called if it exists.
118 .TP
119 .BR \-l , " \-\-lazy"
120 Lazy unmount. Detach the filesystem from the file hierarchy now,
121 and clean up all references to this filesystem as soon as it is not busy
122 anymore.
123
124 A system reboot would be expected in near future if you're going to use this
125 option for network filesystem or local filesystem with submounts. The
126 recommended use-case for \fBumount \-l\fR is to prevent hangs on shutdown due to
127 an unreachable network share where a normal umount will hang due to a downed
128 server or a network partition. Remounts of the share will not be possible.
129
130 .TP
131 .BR \-N , " \-\-namespace " \fIns
132 Perform umount in namespace specified by \fIns\fR.
133 \fIns\fR is either PID of process running in that namespace
134 or special file representing that namespace.
135 .sp
136 .BR umount (8)
137 switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls
138 .BR umount (2)
139 system call, otherwise it runs in the original namespace. It means that the target namespace does not have
140 to contain any libraries or another requirements necessary to execute
141 .BR umount (2)
142 command.
143 .sp
144 See \fBnamespaces\fR(7) for more information.
145 .TP
146 .BR \-n , " \-\-no\-mtab"
147 Unmount without writing in
148 .IR /etc/mtab .
149 .TP
150 .BR \-O , " \-\-test\-opts " \fIoption\fR...
151 Unmount only the filesystems that have the specified option set in
152 .IR /etc/fstab .
153 More than one option may be specified in a comma-separated list.
154 Each option can be prefixed with
155 .B no
156 to indicate that no action should be taken for this option.
157 .TP
158 .BR \-q , " \-\-quiet"
159 Suppress "not mounted" error messages.
160 .TP
161 .BR \-R , " \-\-recursive"
162 Recursively unmount each specified directory. Recursion for each directory will
163 stop if any unmount operation in the chain fails for any reason. The relationship
164 between mountpoints is determined by /proc/self/mountinfo entries. The filesystem
165 must be specified by mountpoint path; a recursive unmount by device name (or UUID)
166 is unsupported.
167 .TP
168 .BR \-r , " \-\-read\-only"
169 When an unmount fails, try to remount the filesystem read-only.
170 .TP
171 .BR \-t , " \-\-types " \fItype\fR...
172 Indicate that the actions should only be taken on filesystems of the
173 specified
174 .IR type .
175 More than one type may be specified in a comma-separated list. The list
176 of filesystem types can be prefixed with
177 .B no
178 to indicate that no action should be taken for all of the mentioned types.
179 Note that
180 .B umount
181 reads information about mounted filesystems from kernel (/proc/mounts) and
182 filesystem names may be different than filesystem names used in the /etc/fstab
183 (e.g., "nfs4" vs. "nfs").
184 .TP
185 .BR \-v , " \-\-verbose"
186 Verbose mode.
187 .TP
188 .BR \-V , " \-\-version"
189 Display version information and exit.
190 .TP
191 .BR \-h , " \-\-help"
192 Display help text and exit.
193 .SH NON-SUPERUSER UMOUNTS
194 Normally, only the superuser can umount filesystems.
195 However, when
196 .I fstab
197 contains the
198 .B user
199 option on a line, anybody can umount the corresponding filesystem. For more details see
200 .BR mount (8)
201 man page.
202 .PP
203 Since version 2.34 \fBumount\fR command allows to perform umount operation also
204 for fuse filesystems if kernel mount table contains user's ID. In this case fstab
205 user= mount option is not required.
206 .PP
207 Since version 2.35 \fBumount\fR command does not exit when user permissions are
208 inadequate by internal libmount security rules. It drops suid permissions
209 and continue as regular non-root user. It allows to support use-cases where
210 root permissions are not necessary (e.g., fuse filesystems, user namespaces,
211 etc).
212 .SH LOOP DEVICE
213 The
214 .B umount
215 command will automatically detach loop device previously initialized by
216 .BR mount (8)
217 command independently of /etc/mtab.
218
219 In this case the device is initialized with "autoclear" flag (see
220 .BR losetup (8)
221 output for more details), otherwise it's necessary to use the option \fB \-\-detach\-loop\fR
222 or call \fBlosetup \-d <device>\fR. The autoclear feature is supported since Linux 2.6.25.
223 .SH EXTERNAL HELPERS
224 The syntax of external unmount helpers is:
225 .PP
226 .RS
227 .BI umount. suffix
228 .RI { directory | device }
229 .RB [ \-flnrv ]
230 .RB [ \-N
231 .IR namespace ]
232 .RB [ \-t
233 .IR type . subtype ]
234 .RE
235 .PP
236 where \fIsuffix\fR is the filesystem type (or the value from a
237 \fBuhelper=\fR or \fBhelper=\fR marker in the mtab file).
238 The \fB\-t\fR option can be used for filesystems that
239 have subtype support. For example:
240 .PP
241 .RS
242 .B umount.fuse \-t fuse.sshfs
243 .RE
244 .PP
245 A \fBuhelper=\fIsomething\fR marker (unprivileged helper) can appear in
246 the \fI/etc/mtab\fR file when ordinary users need to be able to unmount
247 a mountpoint that is not defined in \fI/etc/fstab\fR
248 (for example for a device that was mounted by \fBudisks\fR(1)).
249 .PP
250 A \fBhelper=\fItype\fR marker in the mtab file will redirect
251 all unmount requests
252 to the \fB/sbin/umount.\fItype\fR helper independently of UID.
253 .PP
254 Note that \fI/etc/mtab\fR is currently deprecated and helper= and another
255 userspace mount options are maintained by libmount.
256 .SH ENVIRONMENT
257 .IP LIBMOUNT_FSTAB=<path>
258 overrides the default location of the fstab file (ignored for suid)
259 .IP LIBMOUNT_MTAB=<path>
260 overrides the default location of the mtab file (ignored for suid)
261 .IP LIBMOUNT_DEBUG=all
262 enables libmount debug output
263 .SH FILES
264 .TP
265 .I /etc/mtab
266 table of mounted filesystems (deprecated and usually replaced by
267 symlink to /proc/mounts)
268 .TP
269 .I /etc/fstab
270 table of known filesystems
271 .TP
272 .I /proc/self/mountinfo
273 table of mounted filesystems generated by kernel.
274 .SH HISTORY
275 A
276 .B umount
277 command appeared in Version 6 AT&T UNIX.
278 .SH SEE ALSO
279 .BR umount (2),
280 .BR losetup (8),
281 .BR mount (8)
282 .SH AVAILABILITY
283 The umount command is part of the util-linux package and is available from
284 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
285 Linux Kernel Archive
286 .UE .