1UMOUNT(8) System Administration UMOUNT(8)
2
3
4
6 umount - unmount filesystems
7
9 umount -a [-dflnrv] [-t fstype] [-O option...]
10
11 umount [-dflnrv] {directory|device}...
12
13 umount -h|-V
14
15
17 The umount command detaches the mentioned filesystem(s) from the file
18 hierarchy. A filesystem is specified by giving the directory where it
19 has been mounted. Giving the special device on which the filesystem
20 lives may also work, but is obsolete, mainly because it will fail in
21 case this device was mounted on more than one directory.
22
23 Note that a filesystem cannot be unmounted when it is 'busy' - for ex‐
24 ample, when there are open files on it, or when some process has its
25 working directory there, or when a swap file on it is in use. The of‐
26 fending process could even be umount itself - it opens libc, and libc
27 in its turn may open for example locale files. A lazy unmount avoids
28 this problem, but it may introduce other issues. See --lazy description
29 below.
30
32 -a, --all
33 All of the filesystems described in /proc/self/mountinfo (or in
34 deprecated /etc/mtab) are unmounted, except the proc, devfs, de‐
35 vpts, sysfs, rpc_pipefs and nfsd filesystems. This list of the
36 filesystems may be replaced by --types umount option.
37
38 -A, --all-targets
39 Unmount all mountpoints in the current mount namespace for the
40 specified filesystem. The filesystem can be specified by one of
41 the mountpoints or the device name (or UUID, etc.). When this
42 option is used together with --recursive, then all nested mounts
43 within the filesystem are recursively unmounted. This option is
44 only supported on systems where /etc/mtab is a symlink to
45 /proc/mounts.
46
47 -c, --no-canonicalize
48 Do not canonicalize paths. The paths canonicalization is based
49 on stat(2) and readlink(2) system calls. These system calls may
50 hang in some cases (for example on NFS if server is not avail‐
51 able). The option has to be used with canonical path to the
52 mount point.
53
54 This option is silently ignored by umount for non-root users.
55
56 For more details about this option see the mount(8) man page.
57 Note that umount does not pass this option to the
58 /sbin/umount.type helpers.
59
60 -d, --detach-loop
61 When the unmounted device was a loop device, also free this loop
62 device. This option is unnecessary for devices initialized by
63 mount(8), in this case "autoclear" functionality is enabled by
64 default.
65
66 --fake Causes everything to be done except for the actual system call
67 or umount helper execution; this 'fakes' unmounting the filesys‐
68 tem. It can be used to remove entries from the deprecated
69 /etc/mtab that were unmounted earlier with the -n option.
70
71 -f, --force
72 Force an unmount (in case of an unreachable NFS system).
73
74 Note that this option does not guarantee that umount command
75 does not hang. It's strongly recommended to use absolute paths
76 without symlinks to avoid unwanted readlink and stat system
77 calls on unreachable NFS in umount.
78
79 -i, --internal-only
80 Do not call the /sbin/umount.filesystem helper even if it ex‐
81 ists. By default such a helper program is called if it exists.
82
83 -l, --lazy
84 Lazy unmount. Detach the filesystem from the file hierarchy
85 now, and clean up all references to this filesystem as soon as
86 it is not busy anymore.
87
88 A system reboot would be expected in near future if you're going
89 to use this option for network filesystem or local filesystem
90 with submounts. The recommended use-case for umount -l is to
91 prevent hangs on shutdown due to an unreachable network share
92 where a normal umount will hang due to a downed server or a net‐
93 work partition. Remounts of the share will not be possible.
94
95
96 -N, --namespace ns
97 Perform umount in the mount namespace specified by ns. ns is
98 either PID of process running in that namespace or special file
99 representing that namespace.
100
101 umount(8) switches to the namespace when it reads /etc/fstab,
102 writes /etc/mtab (or writes to /run/mount) and calls umount(2)
103 system call, otherwise it runs in the original namespace. It
104 means that the target mount namespace does not have to contain
105 any libraries or other requirements necessary to execute
106 umount(2) command.
107
108 See mount_namespaces(7) for more information.
109
110 -n, --no-mtab
111 Unmount without writing in /etc/mtab.
112
113 -O, --test-opts option...
114 Unmount only the filesystems that have the specified option set
115 in /etc/fstab. More than one option may be specified in a
116 comma-separated list. Each option can be prefixed with no to
117 indicate that no action should be taken for this option.
118
119 -q, --quiet
120 Suppress "not mounted" error messages.
121
122 -R, --recursive
123 Recursively unmount each specified directory. Recursion for
124 each directory will stop if any unmount operation in the chain
125 fails for any reason. The relationship between mountpoints is
126 determined by /proc/self/mountinfo entries. The filesystem must
127 be specified by mountpoint path; a recursive unmount by device
128 name (or UUID) is unsupported.
129
130 -r, --read-only
131 When an unmount fails, try to remount the filesystem read-only.
132
133 -t, --types type...
134 Indicate that the actions should only be taken on filesystems of
135 the specified type. More than one type may be specified in a
136 comma-separated list. The list of filesystem types can be pre‐
137 fixed with no to indicate that no action should be taken for all
138 of the mentioned types. Note that umount reads information
139 about mounted filesystems from kernel (/proc/mounts) and
140 filesystem names may be different than filesystem names used in
141 the /etc/fstab (e.g., "nfs4" vs. "nfs").
142
143 -v, --verbose
144 Verbose mode.
145
146 -V, --version
147 Display version information and exit.
148
149 -h, --help
150 Display help text and exit.
151
153 Normally, only the superuser can umount filesystems. However, when
154 fstab contains the user option on a line, anybody can umount the corre‐
155 sponding filesystem. For more details see mount(8) man page.
156
157 Since version 2.34 the umount command can be used to perform umount op‐
158 eration also for fuse filesystems if kernel mount table contains user's
159 ID. In this case fstab user= mount option is not required.
160
161 Since version 2.35 umount command does not exit when user permissions
162 are inadequate by internal libmount security rules. It drops suid per‐
163 missions and continue as regular non-root user. This can be used to
164 support use-cases where root permissions are not necessary (e.g., fuse
165 filesystems, user namespaces, etc).
166
168 The umount command will automatically detach loop device previously
169 initialized by mount(8) command independently of /etc/mtab.
170
171 In this case the device is initialized with "autoclear" flag (see los‐
172 etup(8) output for more details), otherwise it's necessary to use the
173 option --detach-loop or call losetup -d <device>. The autoclear fea‐
174 ture is supported since Linux 2.6.25.
175
177 The syntax of external unmount helpers is:
178
179 umount.suffix {directory|device} [-flnrv] [-N namespace] [-t
180 type.subtype]
181
182 where suffix is the filesystem type (or the value from a uhelper= or
183 helper= marker in the mtab file). The -t option can be used for
184 filesystems that have subtype support. For example:
185
186 umount.fuse -t fuse.sshfs
187
188 A uhelper=something marker (unprivileged helper) can appear in the
189 /etc/mtab file when ordinary users need to be able to unmount a mount‐
190 point that is not defined in /etc/fstab (for example for a device that
191 was mounted by udisks(1)).
192
193 A helper=type marker in the mtab file will redirect all unmount re‐
194 quests to the /sbin/umount.type helper independently of UID.
195
196 Note that /etc/mtab is currently deprecated and helper= and other
197 userspace mount options are maintained by libmount.
198
200 LIBMOUNT_FSTAB=<path>
201 overrides the default location of the fstab file (ignored for
202 suid)
203
204 LIBMOUNT_MTAB=<path>
205 overrides the default location of the mtab file (ignored for
206 suid)
207
208 LIBMOUNT_DEBUG=all
209 enables libmount debug output
210
212 /etc/mtab
213 table of mounted filesystems (deprecated and usually replaced by
214 symlink to /proc/mounts)
215
216 /etc/fstab
217 table of known filesystems
218
219 /proc/self/mountinfo
220 table of mounted filesystems generated by kernel.
221
223 A umount command appeared in Version 6 AT&T UNIX.
224
226 umount(2), losetup(8), mount_namespaces(7) mount(8)
227
229 The umount command is part of the util-linux package and is available
230 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
231 linux/⟩.
232
233
234
235util-linux July 2014 UMOUNT(8)