umount, umount2 - unmount filesystem


   #include <sys/mount.h>

   int umount(const char *target);

   int umount2(const char *target, int flags);


   umount()   and   umount2()  remove  the  attachment  of  the  (topmost)
   filesystem mounted on target.

   Appropriate privilege (Linux: the CAP_SYS_ADMIN capability) is required
   to unmount filesystems.

   Linux  2.1.116  added  the umount2() system call, which, like umount(),
   unmounts a target, but allows additional flags controlling the behavior
   of the operation:

   MNT_FORCE (since Linux 2.1.116)
          Force  unmount  even  if busy.  This can cause data loss.  (Only
          for NFS mounts.)

   MNT_DETACH (since Linux 2.4.11)
          Perform a lazy unmount: make the mount point unavailable for new
          accesses,   immediately   disconnect   the  filesystem  and  all
          filesystems mounted below it from each other and from the  mount
          table,  and  actually  perform  the unmount when the mount point
          ceases to be busy.

   MNT_EXPIRE (since Linux 2.6.8)
          Mark the mount point as  expired.   If  a  mount  point  is  not
          currently  in  use,  then an initial call to umount2() with this
          flag fails with the error EAGAIN, but marks the mount  point  as
          expired.   The  mount  point remains expired as long as it isn't
          accessed by any process.  A  second  umount2()  call  specifying
          MNT_EXPIRE unmounts an expired mount point.  This flag cannot be
          specified with either MNT_FORCE or MNT_DETACH.

   UMOUNT_NOFOLLOW (since Linux 2.6.34)
          Don't dereference target if it is a symbolic  link.   This  flag
          allows  security  problems  to  be  avoided  in set-user-ID-root
          programs that allow unprivileged users to unmount filesystems.


   On success, zero is returned.  On error, -1 is returned, and  errno  is
   set appropriately.


   The  error  values  given below result from filesystem type independent
   errors.  Each filesystem type may have its own special errors  and  its
   own special behavior.  See the Linux kernel source code for details.

   EAGAIN A call to umount2() specifying MNT_EXPIRE successfully marked an
          unbusy filesystem as expired.

   EBUSY  target could not be unmounted because it is busy.

   EFAULT target points outside the user address space.

   EINVAL target is not a mount point.

   EINVAL umount2() was called with MNT_EXPIRE and  either  MNT_DETACH  or

   EINVAL (since Linux 2.6.34)
          umount2() was called with an invalid flag value in flags.

          A pathname was longer than MAXPATHLEN.

   ENOENT A pathname was empty or had a nonexistent component.

   ENOMEM The  kernel  could not allocate a free page to copy filenames or
          data into.

   EPERM  The caller does not have the required privileges.


   MNT_DETACH and MNT_EXPIRE are available in glibc since version 2.11.


   These functions are Linux-specific and should not be used  in  programs
   intended to be portable.


   umount() and shared mount points
   Shared  mount  points  cause  any  mount  activity  on  a  mount point,
   including umount() operations, to be forwarded to  every  shared  mount
   point in the peer group and every slave mount of that peer group.  This
   means that umount() of any peer in a set of shared  mounts  will  cause
   all  of  its  peers  to  be  unmounted  and  all  of their slaves to be
   unmounted as well.

   This propagation of unmount activity can be particularly surprising  on
   systems where every mount point is shared by default.  On such systems,
   recursively bind mounting the root directory of the filesystem  onto  a
   subdirectory   and   then   later  unmounting  that  subdirectory  with
   MNT_DETACH will cause every mount in the mount namespace to  be  lazily

   To  ensure umount() does not propagate in this fashion, the mount point
   may be remounted using a mount() call with a mount_flags argument  that
   includes both MS_REC and MS_PRIVATE prior to umount() being called.

   Historical details
   The  original  umount() function was called as umount(device) and would
   return ENOTBLK when called with something other than  a  block  device.
   In  Linux  0.98p4,  a  call  umount(dir) was added, in order to support
   anonymous devices.  In Linux 2.3.99-pre7, the call  umount(device)  was
   removed,  leaving only umount(dir) (since now devices can be mounted in
   more than one place, so specifying the device does not suffice).


   mount(2), mount_namespaces(7), path_resolution(7), mount(8), umount(8)


   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.