# umount(8) - man - phpMan

[UMOUNT(8)](https://www.chedong.com/phpMan.php/man/UMOUNT/8/markdown)                               System Administration                              [UMOUNT(8)](https://www.chedong.com/phpMan.php/man/UMOUNT/8/markdown)



## NAME
       umount - unmount filesystems

## SYNOPSIS
       **umount** **-a** [**-dflnrv**] [**-t** _fstype_] [**-O** _option_...]

       **umount** [**-dflnrv**] {_directory_|_device_}

       **umount** **-h**|**-V**

## DESCRIPTION
       The **umount** command detaches the mentioned filesystem(s) from the file hierarchy. A filesystem
       is specified by giving the directory where it has been mounted. Giving the special device on
       which the filesystem lives may also work, but is obsolete, mainly because it will fail in
       case this device was mounted on more than one directory.

       Note that a filesystem cannot be unmounted when it is 'busy' - for example, when there are
       open files on it, or when some process has its working directory there, or when a swap file
       on it is in use. The offending process could even be **umount** itself - it opens libc, and libc
       in its turn may open for example locale files. A lazy unmount avoids this problem, but it may
       introduce other issues. See **--lazy** description below.

## OPTIONS
### -a --all
           All of the filesystems described in _/proc/self/mountinfo_ (or in deprecated _/etc/mtab_) are
           unmounted, except the proc, devfs, devpts, sysfs, rpc_pipefs and nfsd filesystems. This
           list of the filesystems may be replaced by **--types** umount option.

### -A --all-targets
           Unmount all mountpoints in the current mount namespace for the specified filesystem. The
           filesystem can be specified by one of the mountpoints or the device name (or UUID, etc.).
           When this option is used together with **--recursive**, then all nested mounts within the
           filesystem are recursively unmounted. This option is only supported on systems where
           _/etc/mtab_ is a symlink to _/proc/mounts_.

### -c --no-canonicalize
           Do not canonicalize paths. The paths canonicalization is based on [**stat**(2)](https://www.chedong.com/phpMan.php/man/stat/2/markdown) and [**readlink**(2)](https://www.chedong.com/phpMan.php/man/readlink/2/markdown)
           system calls. These system calls may hang in some cases (for example on NFS if server is
           not available). The option has to be used with canonical path to the mount point.

           This option is silently ignored by **umount** for non-root users.

           For more details about this option see the [**mount**(8)](https://www.chedong.com/phpMan.php/man/mount/8/markdown) man page. Note that **umount** does not
           pass this option to the **/sbin/umount.**_type_ helpers.

### -d --detach-loop
           When the unmounted device was a loop device, also free this loop device. This option is
           unnecessary for devices initialized by [**mount**(8)](https://www.chedong.com/phpMan.php/man/mount/8/markdown), in this case "autoclear" functionality
           is enabled by default.

### --fake
           Causes everything to be done except for the actual system call or umount helper
           execution; this 'fakes' unmounting the filesystem. It can be used to remove entries from
           the deprecated _/etc/mtab_ that were unmounted earlier with the **-n** option.

### -f --force
           Force an unmount (in case of an unreachable NFS system).

           Note that this option does not guarantee that umount command does not hang. It’s strongly
           recommended to use absolute paths without symlinks to avoid unwanted readlink and stat
           system calls on unreachable NFS in **umount**.

### -i --internal-only
           Do not call the **/sbin/umount.**_filesystem_ helper even if it exists. By default such a
           helper program is called if it exists.

### -l --lazy
           Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all
           references to this filesystem as soon as it is not busy anymore.

           A system reboot would be expected in near future if you’re going to use this option for
           network filesystem or local filesystem with submounts. The recommended use-case for
           **umount** **-l** is to prevent hangs on shutdown due to an unreachable network share where a
           normal umount will hang due to a downed server or a network partition. Remounts of the
           share will not be possible.

### -N --namespace
           Perform umount in the mount namespace specified by _ns_. _ns_ is either PID of process
           running in that namespace or special file representing that namespace.

           **umount** switches to the namespace when it reads _/etc/fstab_, writes _/etc/mtab_ (or writes to
           _/run/mount_) and calls [**umount**(2)](https://www.chedong.com/phpMan.php/man/umount/2/markdown) system call, otherwise it runs in the original namespace.
           It means that the target mount namespace does not have to contain any libraries or other
           requirements necessary to execute [**umount**(2)](https://www.chedong.com/phpMan.php/man/umount/2/markdown) command.

           See **mount**___**[namespaces**(7)](https://www.chedong.com/phpMan.php/man/namespaces/7/markdown) for more information.

### -n --no-mtab
           Unmount without writing in _/etc/mtab_.

### -O --test-opts
           Unmount only the filesystems that have the specified option set in _/etc/fstab_. More than
           one option may be specified in a comma-separated list. Each option can be prefixed with
           **no** to indicate that no action should be taken for this option.

### -q --quiet
           Suppress "not mounted" error messages.

### -R --recursive
           Recursively unmount each specified directory. Recursion for each directory will stop if
           any unmount operation in the chain fails for any reason. The relationship between
           mountpoints is determined by _/proc/self/mountinfo_ entries. The filesystem must be
           specified by mountpoint path; a recursive unmount by device name (or UUID) is
           unsupported. Since version 2.37 it umounts also all over-mounted filesystems (more
           filesystems on the same mountpoint).

### -r --read-only
           When an unmount fails, try to remount the filesystem read-only.

### -t --types
           Indicate that the actions should only be taken on filesystems of the specified _type_. More
           than one type may be specified in a comma-separated list. The list of filesystem types
           can be prefixed with **no** to indicate that no action should be taken for all of the
           mentioned types. Note that **umount** reads information about mounted filesystems from kernel
           (_/proc/mounts_) and filesystem names may be different than filesystem names used in the
           _/etc/fstab_ (e.g., "nfs4" vs. "nfs").

### -v --verbose
           Verbose mode.

### -V --version
           Display version information and exit.

### -h --help
           Display help text and exit.

## NON-SUPERUSER UMOUNTS
       Normally, only the superuser can umount filesystems. However, when _fstab_ contains the **user**
       option on a line, anybody can umount the corresponding filesystem. For more details see
       [**mount**(8)](https://www.chedong.com/phpMan.php/man/mount/8/markdown) man page.

       Since version 2.34 the **umount** command can be used to perform umount operation also for fuse
       filesystems if kernel mount table contains user’s ID. In this case fstab **user=** mount option
       is not required.

       Since version 2.35 **umount** command does not exit when user permissions are inadequate by
       internal libmount security rules. It drops suid permissions and continue as regular non-root
       user. This can be used to support use-cases where root permissions are not necessary (e.g.,
       fuse filesystems, user namespaces, etc).

## LOOP DEVICE
       The **umount** command will automatically detach loop device previously initialized by [**mount**(8)](https://www.chedong.com/phpMan.php/man/mount/8/markdown)
       command independently of _/etc/mtab_.

       In this case the device is initialized with "autoclear" flag (see [**losetup**(8)](https://www.chedong.com/phpMan.php/man/losetup/8/markdown) output for more
       details), otherwise it’s necessary to use the option **--detach-loop** or call **losetup** **-d**
       **<device>**. The autoclear feature is supported since Linux 2.6.25.

## EXTERNAL HELPERS
       The syntax of external unmount helpers is:

          **umount.**_suffix_ {_directory_|_device_} [**-flnrv**] [**-N** _namespace_] [**-t** _type_._subtype_]

       where _suffix_ is the filesystem type (or the value from a **uhelper=** or **helper=** marker in the
       mtab file). The **-t** option can be used for filesystems that have subtype support. For example:

          **umount.fuse** **-t** **fuse.sshfs**

       A **uhelper=**_something_ marker (unprivileged helper) can appear in the _/etc/mtab_ file when
       ordinary users need to be able to unmount a mountpoint that is not defined in _/etc/fstab_ (for
       example for a device that was mounted by [**udisks**(1)](https://www.chedong.com/phpMan.php/man/udisks/1/markdown)).

       A **helper=**_type_ marker in the mtab file will redirect all unmount requests to the
       **/sbin/umount.**_type_ helper independently of UID.

       Note that _/etc/mtab_ is currently deprecated and **helper=** and other userspace mount options are
       maintained by libmount.

## ENVIRONMENT
       LIBMOUNT_FSTAB=<path>
           overrides the default location of the fstab file (ignored for suid)

       LIBMOUNT_MTAB=<path>
           overrides the default location of the mtab file (ignored for suid)

       LIBMOUNT_DEBUG=all
           enables **libmount** debug output

## FILES
       _/etc/mtab_
           table of mounted filesystems (deprecated and usually replaced by symlink to _/proc/mounts_)

       _/etc/fstab_
           table of known filesystems

       _/proc/self/mountinfo_
           table of mounted filesystems generated by kernel.

## HISTORY
       A **umount** command appeared in Version 6 AT&T UNIX.

## SEE ALSO
       [**umount**(2)](https://www.chedong.com/phpMan.php/man/umount/2/markdown), [**losetup**(8)](https://www.chedong.com/phpMan.php/man/losetup/8/markdown), **mount**___**[namespaces**(7)](https://www.chedong.com/phpMan.php/man/namespaces/7/markdown), [**mount**(8)](https://www.chedong.com/phpMan.php/man/mount/8/markdown)

## REPORTING BUGS
       For bug reports, use the issue tracker at <https://github.com/karelzak/util-linux/issues>.

## AVAILABILITY
       The **umount** command is part of the util-linux package which can be downloaded from Linux
       Kernel Archive <<https://www.kernel.org/pub/linux/utils/util-linux/>>.



util-linux 2.37.2                            2021-06-02                                    [UMOUNT(8)](https://www.chedong.com/phpMan.php/man/UMOUNT/8/markdown)
