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