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