1 .\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
2 .\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
3 .\" and Copyright (C) 2002, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
27 .\" 2008-10-06, mtk: Created this as a new page by splitting
28 .\" umount/umount2 material out of mount.2
30 .TH UMOUNT 2 2010-06-19 "Linux" "Linux Programmer's Manual"
32 umount, umount2 \- unmount file system
35 .B "#include <sys/mount.h>"
37 .BI "int umount(const char *" target );
39 .BI "int umount2(const char *" target ", int " flags );
45 remove the attachment of the (topmost) file system mounted on
47 .\" Note: the kernel naming differs from the glibc naming
48 .\" umount2 is the glibc name for what the kernel now calls umount
49 .\" and umount is the glibc name for oldumount
51 Appropriate privilege (Linux: the
53 capability) is required to unmount file systems.
55 Linux 2.1.116 added the
57 system call, which, like
59 unmounts a target, but allows additional
61 controlling the behavior of the operation:
63 .BR MNT_FORCE " (since Linux 2.1.116)"
64 Force unmount even if busy.
65 This can cause data loss.
66 (Only for NFS mounts.)
68 .BR MNT_DETACH " (since Linux 2.4.11)"
69 Perform a lazy unmount: make the mount point unavailable for
70 new accesses, and actually perform the unmount when the mount point
73 .BR MNT_EXPIRE " (since Linux 2.6.8)"
74 Mark the mount point as expired.
75 If a mount point is not currently in use, then an initial call to
77 with this flag fails with the error
79 but marks the mount point as expired.
80 The mount point remains expired as long as it isn't accessed
86 unmounts an expired mount point.
87 This flag cannot be specified with either
92 .BR UMOUNT_NOFOLLOW " (since Linux 2.6.34)"
93 .\" Later added to 2.6.33-stable
96 if it is a symbolic link.
97 This flag allows security problems to be avoided in set-user-ID-\fIroot\fP
98 programs that allow unprivileged users to unmount file systems.
100 On success, zero is returned.
101 On error, \-1 is returned, and
103 is set appropriately.
105 The error values given below result from file-system type independent
107 Each file system type may have its own special errors and its
108 own special behavior.
109 See the Linux kernel source code for details.
116 successfully marked an unbusy file system as expired.
120 could not be unmounted because it is busy.
124 points outside the user address space.
128 is not a mount point.
139 A pathname was longer than
143 A pathname was empty or had a nonexistent component.
146 The kernel could not allocate a free page to copy filenames or data into.
149 The caller does not have the required privileges.
154 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=10092
155 are available in glibc since version 2.11.
157 These functions are Linux-specific and should not be used in
158 programs intended to be portable.
162 function was called as \fIumount(device)\fP and would return
164 when called with something other than a block device.
165 In Linux 0.98p4 a call \fIumount(dir)\fP was added, in order to
166 support anonymous devices.
167 In Linux 2.3.99-pre7 the call \fIumount(device)\fP was removed,
168 leaving only \fIumount(dir)\fP (since now devices can be mounted
169 in more than one place, so specifying the device does not suffice).
172 .BR path_resolution (7),