]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/umount.8
lsblk: allow to specify tree column
[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
031800ff 58files. A lazy unmount avoids this problem, but it may introduce another
b9c3b903 59issues. See \fB\-\-lazy\fR description below.
7c289c7c
SK
60.SH OPTIONS
61.TP
b59c86c8 62.BR \-a , " \-\-all"
6ec8a0ba 63All of the filesystems described in
29ad8689
KZ
64.I /proc/self/mountinfo
65(or in deprecated /etc/mtab)
66are unmounted, except the proc, devfs, devpts, sysfs, rpc_pipefs and nfsd
67filesystems. This list of the filesystems may be replaced by \fB\-\-types\fR
68umount option.
7c289c7c 69.TP
b06c1ca6 70.BR \-A , " \-\-all\-targets"
6f7bce86 71Unmount all mountpoints in the current namespace for the specified filesystem.
b59c86c8
BS
72The filesystem can be specified by one of the mountpoints or the device name (or
73UUID, etc.). When this option is used together with \fB\-\-recursive\fR, then
74all nested mounts within the filesystem are recursively unmounted.
75This option is only supported on systems where /etc/mtab is a symlink
fd7c4924 76to /proc/mounts.
4eb49f63 77.TP
b06c1ca6 78.BR \-c , " \-\-no\-canonicalize"
9f1af331
KZ
79Do not canonicalize paths. The paths canonicalization is based on
80.BR stat (2)
81and
82.BR readlink (2)
83system calls. These system calls may hang in some cases (for example on NFS if
84server is not available). The option has to be used with canonical path to the
85mount point.
86
87For more details about this option see the
8323d9fd 88.BR mount (8)
9f1af331 89man page. Note that \fBumount\fR does not pass this option to the
b59c86c8
BS
90.BI /sbin/umount. type
91helpers.
7c289c7c 92.TP
b06c1ca6 93.BR \-d , " \-\-detach\-loop"
b59c86c8 94When the unmounted device was a loop device, also free this loop
d00eb87b
KZ
95device. This option is unnecessary for devices initialized by
96.BR mount (8),
97in this case "autoclear" functionality is enabled by default.
7c289c7c 98.TP
b59c86c8 99.B \-\-fake
28cdf9c6
KZ
100Causes everything to be done except for the actual system call or umount helper
101execution; this 'fakes' unmounting the filesystem. It can be used to remove
29ad8689 102entries from the deprecated
7c289c7c
SK
103.I /etc/mtab
104that were unmounted earlier with the
105.B \-n
106option.
107.TP
b59c86c8 108.BR \-f , " \-\-force"
9f3d0fce 109Force an unmount (in case of an unreachable NFS system).
dcc3b1fc
KZ
110
111Note that this option does not guarantee that umount command does not hang.
112It's strongly recommended to use absolute paths without symlinks to avoid
3be5d977 113unwanted readlink and stat system calls on unreachable NFS in umount.
7c289c7c 114.TP
b06c1ca6 115.BR \-i , " \-\-internal\-only"
b59c86c8
BS
116Do not call the \fB/sbin/umount.\fIfilesystem\fR helper even if it exists.
117By default such a helper program is called if it exists.
7c289c7c 118.TP
b59c86c8
BS
119.BR \-l , " \-\-lazy"
120Lazy unmount. Detach the filesystem from the file hierarchy now,
121and clean up all references to this filesystem as soon as it is not busy
9f3d0fce 122anymore.
031800ff
KZ
123
124A system reboot would be expected in near future if you're going to use this
125option for network filesystem or local filesystem with submounts. The
126recommended use-case for \fBumount -l\fR is to prevent hangs on shutdown due to
127an unreachable network share where a normal umount will hang due to a downed
128server or a network partition. Remounts of the share will not be possible.
129
d45e8ef9
VD
130.TP
131.BR \-N , " \-\-namespace " \fIns
132Perform umount in namespace specified by \fIns\fR.
c1e70afe
VD
133\fIns\fR is either PID of process running in that namespace
134or special file representing that namespace.
b6cc1210
KZ
135.sp
136.BR umount (8)
137switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls
559ee54a 138.BR umount (2)
b6cc1210
KZ
139system call, otherwise it runs in the original namespace. It means that the target namespace does not have
140to contain any libraries or another requirements necessary to execute
559ee54a 141.BR umount (2)
b6cc1210
KZ
142command.
143.sp
c1e70afe 144See \fBnamespaces\fR(7) for more information.
b59c86c8 145.TP
b06c1ca6 146.BR \-n , " \-\-no\-mtab"
7c289c7c
SK
147Unmount without writing in
148.IR /etc/mtab .
149.TP
b06c1ca6 150.BR \-O , " \-\-test\-opts " \fIoption\fR...
b59c86c8 151Unmount only the filesystems that have the specified option set in
7c289c7c 152.IR /etc/fstab .
6ec8a0ba 153More than one option may be specified in a comma-separated list.
7c289c7c
SK
154Each option can be prefixed with
155.B no
b59c86c8 156to indicate that no action should be taken for this option.
7c289c7c 157.TP
d5fd9ac6
KZ
158.BR \-q , " \-\-quiet"
159Suppress "not mounted" error messages.
160.TP
b59c86c8
BS
161.BR \-R , " \-\-recursive"
162Recursively unmount each specified directory. Recursion for each directory will
163stop if any unmount operation in the chain fails for any reason. The relationship
164between mountpoints is determined by /proc/self/mountinfo entries. The filesystem
165must be specified by mountpoint path; a recursive unmount by device name (or UUID)
fd2b0ce5 166is unsupported.
13ee1c91 167.TP
b06c1ca6 168.BR \-r , " \-\-read\-only"
b59c86c8 169When an unmount fails, try to remount the filesystem read-only.
7c289c7c 170.TP
b59c86c8 171.BR \-t , " \-\-types " \fItype\fR...
6ec8a0ba 172Indicate that the actions should only be taken on filesystems of the
7c289c7c
SK
173specified
174.IR type .
6ec8a0ba
BS
175More than one type may be specified in a comma-separated list. The list
176of filesystem types can be prefixed with
7c289c7c 177.B no
b59c86c8 178to indicate that no action should be taken for all of the mentioned types.
6c820514
KZ
179Note that
180.B umount
181reads information about mounted filesystems from kernel (/proc/mounts) and
182filesystem names may be different than filesystem names used in the /etc/fstab
183(e.g. "nfs4" vs. "nfs").
7c289c7c 184.TP
b59c86c8 185.BR \-v , " \-\-verbose"
7c289c7c
SK
186Verbose mode.
187.TP
b59c86c8 188.BR \-V , " \-\-version"
b4362b6f 189Display version information and exit.
b59c86c8
BS
190.TP
191.BR \-h , " \-\-help"
192Display help text and exit.
193.SH "LOOP DEVICE"
7c289c7c
SK
194The
195.B umount
d00eb87b
KZ
196command will automatically detach loop device previously initialized by
197.BR mount (8)
198command independently of /etc/mtab.
199
200In this case the device is initialized with "autoclear" flag (see
201.BR losetup (8)
202output for more details), otherwise it's necessary to use the option \fB \-\-detach\-loop\fR
203or call \fBlosetup -d <device>\fR. The autoclear feature is supported since Linux 2.6.25.
d6983300 204.SH EXTERNAL HELPERS
b59c86c8 205The syntax of external unmount helpers is:
7c289c7c 206.PP
d6983300
BS
207.RS
208.BI umount. suffix
b59c86c8
BS
209.RI { directory | device }
210.RB [ \-flnrv ]
c5b63d28
KZ
211.RB [ \-N
212.IR namespace ]
7c289c7c 213.RB [ \-t
b59c86c8 214.IR type . subtype ]
d6983300 215.RE
7c289c7c 216.PP
851c2bd5
BS
217where \fIsuffix\fR is the filesystem type (or the value from a
218\fBuhelper=\fR or \fBhelper=\fR marker in the mtab file).
d6983300
BS
219The \fB\-t\fR option can be used for filesystems that
220have subtype support. For example:
7c289c7c 221.PP
d6983300
BS
222.RS
223.B umount.fuse \-t fuse.sshfs
224.RE
851c2bd5
BS
225.PP
226A \fBuhelper=\fIsomething\fR marker (unprivileged helper) can appear in
227the \fI/etc/mtab\fR file when ordinary users need to be able to unmount
228a mountpoint that is not defined in \fI/etc/fstab\fR
229(for example for a device that was mounted by \fBudisks\fR(1)).
230.PP
231A \fBhelper=\fItype\fR marker in the mtab file will redirect
232all unmount requests
233to the \fB/sbin/umount.\fItype\fR helper independently of UID.
29ad8689
KZ
234.PP
235Note that \fI/etc/mtab\fR is currently deprecated and helper= and another
236userspace mount options are maintained by libmount.
7c289c7c 237.SH FILES
b59c86c8 238.TP
46f057ed 239.I /etc/mtab
29ad8689
KZ
240table of mounted filesystems (deprecated and usually replaced by
241symlink to /proc/mounts)
b59c86c8 242.TP
46f057ed 243.I /etc/fstab
851c2bd5 244table of known filesystems
29ad8689 245.TP
46f057ed 246.I /proc/self/mountinfo
29ad8689 247table of mounted filesystems generated by kernel.
ca3dbca1
DB
248.SH ENVIRONMENT
249.IP LIBMOUNT_FSTAB=<path>
68e422ec 250overrides the default location of the fstab file (ignored for suid)
ca3dbca1 251.IP LIBMOUNT_MTAB=<path>
68e422ec
KZ
252overrides the default location of the mtab file (ignored for suid)
253.IP LIBMOUNT_DEBUG=all
254enables libmount debug output
7c289c7c
SK
255.SH "SEE ALSO"
256.BR umount (2),
f053ff1e
MK
257.BR losetup (8),
258.BR mount (8)
7c289c7c
SK
259.SH HISTORY
260A
261.B umount
262command appeared in Version 6 AT&T UNIX.
263.SH AVAILABILITY
264The umount command is part of the util-linux package and is available from
d673b74e 265.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
7c289c7c
SK
266Linux Kernel Archive
267.UE .