]>
Commit | Line | Data |
---|---|---|
7c289c7c SK |
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 | .\" | |
b59c86c8 | 25 | .TH UMOUNT 8 "July 2014" "util-linux" "System Administration" |
7c289c7c SK |
26 | .SH NAME |
27 | umount \- unmount file systems | |
28 | .SH SYNOPSIS | |
7c289c7c SK |
29 | .B umount \-a |
30 | .RB [ \-dflnrv ] | |
31 | .RB [ \-t | |
6ec8a0ba | 32 | .IR fstype ] |
7c289c7c | 33 | .RB [ \-O |
b59c86c8 BS |
34 | .IR option ...] |
35 | .sp | |
7c289c7c SK |
36 | .B umount |
37 | .RB [ \-dflnrv ] | |
b59c86c8 BS |
38 | .RI { directory | device }... |
39 | .sp | |
40 | .B umount | |
41 | .BR \-h | \-V | |
42 | ||
7c289c7c SK |
43 | .SH DESCRIPTION |
44 | The | |
45 | .B umount | |
6ec8a0ba | 46 | command detaches the mentioned file system(s) from the file hierarchy. A |
7c289c7c SK |
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 | |
031800ff | 58 | files. A lazy unmount avoids this problem, but it may introduce another |
b9c3b903 | 59 | issues. See \fB\-\-lazy\fR description below. |
7c289c7c SK |
60 | .SH OPTIONS |
61 | .TP | |
b59c86c8 | 62 | .BR \-a , " \-\-all" |
6ec8a0ba | 63 | All of the filesystems described in |
29ad8689 KZ |
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. | |
7c289c7c | 69 | .TP |
b06c1ca6 | 70 | .BR \-A , " \-\-all\-targets" |
2a425c02 MK |
71 | Unmount all mountpoints in the current mount namespace |
72 | for the specified filesystem. | |
b59c86c8 BS |
73 | The filesystem can be specified by one of the mountpoints or the device name (or |
74 | UUID, etc.). When this option is used together with \fB\-\-recursive\fR, then | |
75 | all nested mounts within the filesystem are recursively unmounted. | |
76 | This option is only supported on systems where /etc/mtab is a symlink | |
fd7c4924 | 77 | to /proc/mounts. |
4eb49f63 | 78 | .TP |
b06c1ca6 | 79 | .BR \-c , " \-\-no\-canonicalize" |
9f1af331 KZ |
80 | Do not canonicalize paths. The paths canonicalization is based on |
81 | .BR stat (2) | |
82 | and | |
83 | .BR readlink (2) | |
84 | system calls. These system calls may hang in some cases (for example on NFS if | |
85 | server is not available). The option has to be used with canonical path to the | |
86 | mount point. | |
87 | ||
88 | For more details about this option see the | |
8323d9fd | 89 | .BR mount (8) |
9f1af331 | 90 | man page. Note that \fBumount\fR does not pass this option to the |
b59c86c8 BS |
91 | .BI /sbin/umount. type |
92 | helpers. | |
7c289c7c | 93 | .TP |
b06c1ca6 | 94 | .BR \-d , " \-\-detach\-loop" |
b59c86c8 | 95 | When the unmounted device was a loop device, also free this loop |
d00eb87b KZ |
96 | device. This option is unnecessary for devices initialized by |
97 | .BR mount (8), | |
98 | in this case "autoclear" functionality is enabled by default. | |
7c289c7c | 99 | .TP |
b59c86c8 | 100 | .B \-\-fake |
28cdf9c6 KZ |
101 | Causes everything to be done except for the actual system call or umount helper |
102 | execution; this 'fakes' unmounting the filesystem. It can be used to remove | |
29ad8689 | 103 | entries from the deprecated |
7c289c7c SK |
104 | .I /etc/mtab |
105 | that were unmounted earlier with the | |
106 | .B \-n | |
107 | option. | |
108 | .TP | |
b59c86c8 | 109 | .BR \-f , " \-\-force" |
9f3d0fce | 110 | Force an unmount (in case of an unreachable NFS system). |
dcc3b1fc KZ |
111 | |
112 | Note that this option does not guarantee that umount command does not hang. | |
113 | It's strongly recommended to use absolute paths without symlinks to avoid | |
3be5d977 | 114 | unwanted readlink and stat system calls on unreachable NFS in umount. |
7c289c7c | 115 | .TP |
b06c1ca6 | 116 | .BR \-i , " \-\-internal\-only" |
b59c86c8 BS |
117 | Do not call the \fB/sbin/umount.\fIfilesystem\fR helper even if it exists. |
118 | By default such a helper program is called if it exists. | |
7c289c7c | 119 | .TP |
b59c86c8 BS |
120 | .BR \-l , " \-\-lazy" |
121 | Lazy unmount. Detach the filesystem from the file hierarchy now, | |
122 | and clean up all references to this filesystem as soon as it is not busy | |
9f3d0fce | 123 | anymore. |
031800ff KZ |
124 | |
125 | A system reboot would be expected in near future if you're going to use this | |
126 | option for network filesystem or local filesystem with submounts. The | |
1c4c6024 | 127 | recommended use-case for \fBumount \-l\fR is to prevent hangs on shutdown due to |
031800ff KZ |
128 | an unreachable network share where a normal umount will hang due to a downed |
129 | server or a network partition. Remounts of the share will not be possible. | |
130 | ||
d45e8ef9 VD |
131 | .TP |
132 | .BR \-N , " \-\-namespace " \fIns | |
2a425c02 | 133 | Perform umount in the mount namespace specified by \fIns\fR. |
c1e70afe VD |
134 | \fIns\fR is either PID of process running in that namespace |
135 | or special file representing that namespace. | |
b6cc1210 KZ |
136 | .sp |
137 | .BR umount (8) | |
138 | switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls | |
559ee54a | 139 | .BR umount (2) |
2a425c02 MK |
140 | system call, otherwise it runs in the original namespace. |
141 | It means that the target mount namespace does not have | |
b6cc1210 | 142 | to contain any libraries or another requirements necessary to execute |
559ee54a | 143 | .BR umount (2) |
b6cc1210 KZ |
144 | command. |
145 | .sp | |
2a425c02 | 146 | See \fBmount_namespaces\fR(7) for more information. |
b59c86c8 | 147 | .TP |
b06c1ca6 | 148 | .BR \-n , " \-\-no\-mtab" |
7c289c7c SK |
149 | Unmount without writing in |
150 | .IR /etc/mtab . | |
151 | .TP | |
b06c1ca6 | 152 | .BR \-O , " \-\-test\-opts " \fIoption\fR... |
b59c86c8 | 153 | Unmount only the filesystems that have the specified option set in |
7c289c7c | 154 | .IR /etc/fstab . |
6ec8a0ba | 155 | More than one option may be specified in a comma-separated list. |
7c289c7c SK |
156 | Each option can be prefixed with |
157 | .B no | |
b59c86c8 | 158 | to indicate that no action should be taken for this option. |
7c289c7c | 159 | .TP |
d5fd9ac6 KZ |
160 | .BR \-q , " \-\-quiet" |
161 | Suppress "not mounted" error messages. | |
162 | .TP | |
b59c86c8 BS |
163 | .BR \-R , " \-\-recursive" |
164 | Recursively unmount each specified directory. Recursion for each directory will | |
165 | stop if any unmount operation in the chain fails for any reason. The relationship | |
166 | between mountpoints is determined by /proc/self/mountinfo entries. The filesystem | |
167 | must be specified by mountpoint path; a recursive unmount by device name (or UUID) | |
fd2b0ce5 | 168 | is unsupported. |
13ee1c91 | 169 | .TP |
b06c1ca6 | 170 | .BR \-r , " \-\-read\-only" |
b59c86c8 | 171 | When an unmount fails, try to remount the filesystem read-only. |
7c289c7c | 172 | .TP |
b59c86c8 | 173 | .BR \-t , " \-\-types " \fItype\fR... |
6ec8a0ba | 174 | Indicate that the actions should only be taken on filesystems of the |
7c289c7c SK |
175 | specified |
176 | .IR type . | |
6ec8a0ba BS |
177 | More than one type may be specified in a comma-separated list. The list |
178 | of filesystem types can be prefixed with | |
7c289c7c | 179 | .B no |
b59c86c8 | 180 | to indicate that no action should be taken for all of the mentioned types. |
6c820514 KZ |
181 | Note that |
182 | .B umount | |
183 | reads information about mounted filesystems from kernel (/proc/mounts) and | |
184 | filesystem names may be different than filesystem names used in the /etc/fstab | |
eb024893 | 185 | (e.g., "nfs4" vs. "nfs"). |
7c289c7c | 186 | .TP |
b59c86c8 | 187 | .BR \-v , " \-\-verbose" |
7c289c7c SK |
188 | Verbose mode. |
189 | .TP | |
b59c86c8 | 190 | .BR \-V , " \-\-version" |
b4362b6f | 191 | Display version information and exit. |
b59c86c8 BS |
192 | .TP |
193 | .BR \-h , " \-\-help" | |
194 | Display help text and exit. | |
5a829806 | 195 | .SH NON-SUPERUSER UMOUNTS |
6497f2d9 KZ |
196 | Normally, only the superuser can umount filesystems. |
197 | However, when | |
198 | .I fstab | |
199 | contains the | |
200 | .B user | |
201 | option on a line, anybody can umount the corresponding filesystem. For more details see | |
202 | .BR mount (8) | |
203 | man page. | |
204 | .PP | |
205 | Since version 2.34 \fBumount\fR command allows to perform umount operation also | |
206 | for fuse filesystems if kernel mount table contains user's ID. In this case fstab | |
207 | user= mount option is not required. | |
208 | .PP | |
209 | Since version 2.35 \fBumount\fR command does not exit when user permissions are | |
210 | inadequate by internal libmount security rules. It drops suid permissions | |
211 | and continue as regular non-root user. It allows to support use-cases where | |
eb024893 | 212 | root permissions are not necessary (e.g., fuse filesystems, user namespaces, |
6497f2d9 | 213 | etc). |
5a829806 | 214 | .SH LOOP DEVICE |
7c289c7c SK |
215 | The |
216 | .B umount | |
d00eb87b KZ |
217 | command will automatically detach loop device previously initialized by |
218 | .BR mount (8) | |
219 | command independently of /etc/mtab. | |
220 | ||
221 | In this case the device is initialized with "autoclear" flag (see | |
222 | .BR losetup (8) | |
223 | output for more details), otherwise it's necessary to use the option \fB \-\-detach\-loop\fR | |
1c4c6024 | 224 | or call \fBlosetup \-d <device>\fR. The autoclear feature is supported since Linux 2.6.25. |
d6983300 | 225 | .SH EXTERNAL HELPERS |
b59c86c8 | 226 | The syntax of external unmount helpers is: |
7c289c7c | 227 | .PP |
d6983300 BS |
228 | .RS |
229 | .BI umount. suffix | |
b59c86c8 BS |
230 | .RI { directory | device } |
231 | .RB [ \-flnrv ] | |
c5b63d28 KZ |
232 | .RB [ \-N |
233 | .IR namespace ] | |
7c289c7c | 234 | .RB [ \-t |
b59c86c8 | 235 | .IR type . subtype ] |
d6983300 | 236 | .RE |
7c289c7c | 237 | .PP |
851c2bd5 BS |
238 | where \fIsuffix\fR is the filesystem type (or the value from a |
239 | \fBuhelper=\fR or \fBhelper=\fR marker in the mtab file). | |
d6983300 BS |
240 | The \fB\-t\fR option can be used for filesystems that |
241 | have subtype support. For example: | |
7c289c7c | 242 | .PP |
d6983300 BS |
243 | .RS |
244 | .B umount.fuse \-t fuse.sshfs | |
245 | .RE | |
851c2bd5 BS |
246 | .PP |
247 | A \fBuhelper=\fIsomething\fR marker (unprivileged helper) can appear in | |
248 | the \fI/etc/mtab\fR file when ordinary users need to be able to unmount | |
249 | a mountpoint that is not defined in \fI/etc/fstab\fR | |
250 | (for example for a device that was mounted by \fBudisks\fR(1)). | |
251 | .PP | |
252 | A \fBhelper=\fItype\fR marker in the mtab file will redirect | |
253 | all unmount requests | |
254 | to the \fB/sbin/umount.\fItype\fR helper independently of UID. | |
29ad8689 KZ |
255 | .PP |
256 | Note that \fI/etc/mtab\fR is currently deprecated and helper= and another | |
257 | userspace mount options are maintained by libmount. | |
380fd9aa MK |
258 | .SH ENVIRONMENT |
259 | .IP LIBMOUNT_FSTAB=<path> | |
260 | overrides the default location of the fstab file (ignored for suid) | |
261 | .IP LIBMOUNT_MTAB=<path> | |
262 | overrides the default location of the mtab file (ignored for suid) | |
263 | .IP LIBMOUNT_DEBUG=all | |
264 | enables libmount debug output | |
7c289c7c | 265 | .SH FILES |
b59c86c8 | 266 | .TP |
46f057ed | 267 | .I /etc/mtab |
29ad8689 KZ |
268 | table of mounted filesystems (deprecated and usually replaced by |
269 | symlink to /proc/mounts) | |
b59c86c8 | 270 | .TP |
46f057ed | 271 | .I /etc/fstab |
851c2bd5 | 272 | table of known filesystems |
29ad8689 | 273 | .TP |
46f057ed | 274 | .I /proc/self/mountinfo |
29ad8689 | 275 | table of mounted filesystems generated by kernel. |
7c289c7c SK |
276 | .SH HISTORY |
277 | A | |
278 | .B umount | |
279 | command appeared in Version 6 AT&T UNIX. | |
ade04bb8 MK |
280 | .SH SEE ALSO |
281 | .BR umount (2), | |
282 | .BR losetup (8), | |
2a425c02 | 283 | .BR mount_namespaces (7) |
ade04bb8 | 284 | .BR mount (8) |
7c289c7c SK |
285 | .SH AVAILABILITY |
286 | The umount command is part of the util-linux package and is available from | |
d673b74e | 287 | .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ |
7c289c7c SK |
288 | Linux Kernel Archive |
289 | .UE . |