]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/umount.8
umount: cleanup umount.8 about mtab
[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.
59 .SH OPTIONS
60 .TP
61 .BR \-a , " \-\-all"
62 All of the filesystems described in
63 .I /proc/self/mountinfo
64 (or in deprecated /etc/mtab)
65 are unmounted, except the proc, devfs, devpts, sysfs, rpc_pipefs and nfsd
66 filesystems. This list of the filesystems may be replaced by \fB\-\-types\fR
67 umount option.
68 .TP
69 .BR \-A , " \-\-all\-targets"
70 Unmount all mountpoints in the current namespace for the specified filesystem.
71 The filesystem can be specified by one of the mountpoints or the device name (or
72 UUID, etc.). When this option is used together with \fB\-\-recursive\fR, then
73 all nested mounts within the filesystem are recursively unmounted.
74 This option is only supported on systems where /etc/mtab is a symlink
75 to /proc/mounts.
76 .TP
77 .BR \-c , " \-\-no\-canonicalize"
78 Do not canonicalize paths. For more details about this option see the
79 .BR mount (8)
80 man page. Note that \fBumount\fR does not pass this option to the
81 .BI /sbin/umount. type
82 helpers.
83 .TP
84 .BR \-d , " \-\-detach\-loop"
85 When the unmounted device was a loop device, also free this loop
86 device. This option is unnecessary for devices initialized by
87 .BR mount (8),
88 in this case "autoclear" functionality is enabled by default.
89 .TP
90 .B \-\-fake
91 Causes everything to be done except for the actual system call or umount helper
92 execution; this 'fakes' unmounting the filesystem. It can be used to remove
93 entries from the deprecated
94 .I /etc/mtab
95 that were unmounted earlier with the
96 .B \-n
97 option.
98 .TP
99 .BR \-f , " \-\-force"
100 Force an unmount (in case of an unreachable NFS system). (Requires kernel
101 2.1.116 or later.)
102
103 Note that this option does not guarantee that umount command does not hang.
104 It's strongly recommended to use absolute paths without symlinks to avoid
105 unwanted readlink and stat syscalls on unreachable NFS in umount.
106 .TP
107 .BR \-i , " \-\-internal\-only"
108 Do not call the \fB/sbin/umount.\fIfilesystem\fR helper even if it exists.
109 By default such a helper program is called if it exists.
110 .TP
111 .BR \-l , " \-\-lazy"
112 Lazy unmount. Detach the filesystem from the file hierarchy now,
113 and clean up all references to this filesystem as soon as it is not busy
114 anymore. (Requires kernel 2.4.11 or later.)
115 .TP
116 .BR \-n , " \-\-no\-mtab"
117 Unmount without writing in
118 .IR /etc/mtab .
119 .TP
120 .BR \-O , " \-\-test\-opts " \fIoption\fR...
121 Unmount only the filesystems that have the specified option set in
122 .IR /etc/fstab .
123 More than one option may be specified in a comma-separated list.
124 Each option can be prefixed with
125 .B no
126 to indicate that no action should be taken for this option.
127 .TP
128 .BR \-R , " \-\-recursive"
129 Recursively unmount each specified directory. Recursion for each directory will
130 stop if any unmount operation in the chain fails for any reason. The relationship
131 between mountpoints is determined by /proc/self/mountinfo entries. The filesystem
132 must be specified by mountpoint path; a recursive unmount by device name (or UUID)
133 is unsupported.
134 .TP
135 .BR \-r , " \-\-read\-only"
136 When an unmount fails, try to remount the filesystem read-only.
137 .TP
138 .BR \-t , " \-\-types " \fItype\fR...
139 Indicate that the actions should only be taken on filesystems of the
140 specified
141 .IR type .
142 More than one type may be specified in a comma-separated list. The list
143 of filesystem types can be prefixed with
144 .B no
145 to indicate that no action should be taken for all of the mentioned types.
146 .BR
147 Note that
148 .B umount
149 reads information about mounted filesystems from kernel (/proc/mounts) and
150 filesystem names may be different than filesystem names used in the /etc/fstab
151 (e.g. "nfs4" vs. "nfs").
152 .TP
153 .BR \-v , " \-\-verbose"
154 Verbose mode.
155 .TP
156 .BR \-V , " \-\-version"
157 Display version information and exit.
158 .TP
159 .BR \-h , " \-\-help"
160 Display help text and exit.
161 .SH "LOOP DEVICE"
162 The
163 .B umount
164 command will automatically detach loop device previously initialized by
165 .BR mount (8)
166 command independently of /etc/mtab.
167
168 In this case the device is initialized with "autoclear" flag (see
169 .BR losetup (8)
170 output for more details), otherwise it's necessary to use the option \fB \-\-detach\-loop\fR
171 or call \fBlosetup -d <device>\fR. The autoclear feature is supported since Linux 2.6.25.
172 .SH EXTERNAL HELPERS
173 The syntax of external unmount helpers is:
174 .PP
175 .RS
176 .BI umount. suffix
177 .RI { directory | device }
178 .RB [ \-flnrv ]
179 .RB [ \-t
180 .IR type . subtype ]
181 .RE
182 .PP
183 where \fIsuffix\fR is the filesystem type (or the value from a
184 \fBuhelper=\fR or \fBhelper=\fR marker in the mtab file).
185 The \fB\-t\fR option can be used for filesystems that
186 have subtype support. For example:
187 .PP
188 .RS
189 .B umount.fuse \-t fuse.sshfs
190 .RE
191 .PP
192 A \fBuhelper=\fIsomething\fR marker (unprivileged helper) can appear in
193 the \fI/etc/mtab\fR file when ordinary users need to be able to unmount
194 a mountpoint that is not defined in \fI/etc/fstab\fR
195 (for example for a device that was mounted by \fBudisks\fR(1)).
196 .PP
197 A \fBhelper=\fItype\fR marker in the mtab file will redirect
198 all unmount requests
199 to the \fB/sbin/umount.\fItype\fR helper independently of UID.
200 .PP
201 Note that \fI/etc/mtab\fR is currently deprecated and helper= and another
202 userspace mount options are maintained by libmount.
203 .SH FILES
204 .TP
205 .B /etc/mtab
206 table of mounted filesystems (deprecated and usually replaced by
207 symlink to /proc/mounts)
208 .TP
209 .B /etc/fstab
210 table of known filesystems
211 .TP
212 .B /proc/self/mountinfo
213 table of mounted filesystems generated by kernel.
214 .SH ENVIRONMENT
215 .IP LIBMOUNT_FSTAB=<path>
216 overrides the default location of the fstab file (ignored for suid)
217 .IP LIBMOUNT_MTAB=<path>
218 overrides the default location of the mtab file (ignored for suid)
219 .IP LIBMOUNT_DEBUG=all
220 enables libmount debug output
221 .SH "SEE ALSO"
222 .BR umount (2),
223 .BR mount (8),
224 .BR losetup (8)
225 .SH HISTORY
226 A
227 .B umount
228 command appeared in Version 6 AT&T UNIX.
229 .SH AVAILABILITY
230 The umount command is part of the util-linux package and is available from
231 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
232 Linux Kernel Archive
233 .UE .