UMOUNT(8) | System Administration | UMOUNT(8) |
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
-A, --all-targets
-c, --no-canonicalize
This option is silently ignored by umount for non-root users.
For more details about this option see the mount(8) man page. Note that umount does not pass this option to the /sbin/umount.type helpers.
-d, --detach-loop
--fake
-f, --force
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
-l, --lazy
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 ns
umount switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls umount(2) 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) command.
See mount_namespaces(7) for more information.
-n, --no-mtab
-O, --test-opts option...
-q, --quiet
-R, --recursive
-r, --read-only
-t, --types type...
-v, --verbose
-V, --version
-h, --help
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) 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) command independently of /etc/mtab.
In this case the device is initialized with "autoclear" flag (see losetup(8) 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)).
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>
LIBMOUNT_MTAB=<path>
LIBMOUNT_DEBUG=all
FILES¶
/etc/mtab
/etc/fstab
/proc/self/mountinfo
HISTORY¶
A umount command appeared in Version 6 AT&T UNIX.
SEE ALSO¶
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/>.
2022-02-14 | util-linux 2.37.4 |