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