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