umount - unmount file systems
umount [-hV]
umount -a [-dflnrv] [-t vfstype]
[-O options]
umount [-dflnrv] {dir|device}...
The umount command detaches the file system(s) mentioned from the file
hierarchy. A file system is specified by giving the directory where it has
been mounted. Giving the special device on which the file system 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 file system 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 another issues. See --lazy description
bellow.
- -a, --all
- All of the file systems described in /etc/mtab are unmounted. (With
umount version 2.7 and later: the proc filesystem is not
unmounted.)
- -A, --all-targets
- Unmount all mountpoints in the current namespace for the specified
filesystem. The filesystem could be specified by one of the mountpoints or
device name (or UUID, etc.). This option could be used together with
--recursive then all nested mounts within the filesystem are
recursively unmounted.
- -c, --no-canonicalize
- Do not canonicalize paths. For more details about this option see the
mount(8) man page.
- -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), in
this case "autoclear" functionality is enabled by default.
- --fake
- Causes everything to be done except for the actual system call; this
'fakes' unmounting the filesystem. It can be used to remove entries from
/etc/mtab that were unmounted earlier with the -n
option.
- -f, --force
- Force unmount (in case of an unreachable NFS system). (Requires kernel
2.1.116 or later.)
- -i, --internal-only
- Do not call the /sbin/umount.<filesystem> helper even if it exists.
By default /sbin/umount.<filesystem> helper is called if one
exists.
- -n, --no-mtab
- Unmount without writing in /etc/mtab.
- -l, --lazy
- Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and
cleanup all references to the filesystem as soon as it is not busy
anymore. (Requires kernel 2.4.11 or later.)
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.
- -O, --test-opts options,list
- Indicate that the actions should only be taken on file systems with the
specified options in /etc/fstab. More than one option type may be
specified in a comma separated list. Each option can be prefixed with
no to specify options for which no action should be taken.
- -R, --recursive
- Recursively unmount each directory specified. 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, recursive
unmount by device name (or UUID) is unsupported.
- -r, --read-only
- In case unmounting fails, try to remount read-only.
- -t, --types vfstype,ext2,ext3
- Indicate that the actions should only be taken on file systems of the
specified type. More than one type may be specified in a comma
separated list. The list of file system types can be prefixed with
no to specify the file system types on which no action should be
taken.
- -v, --verbose
- Verbose mode.
- -h, --help
- Print help message and exit.
- -V, --version
- Print version and exit.
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.
The syntax of external umount helpers is:
/sbin/umount.<suffix>
{dir|device} [-nlfvr] [-t
type.subtype]
where the <suffix> is filesystem type or a value from
"uhelper=" or "helper=" mtab option. The -t option is
used for filesystems with subtypes support (for example /sbin/mount.fuse -t
fuse.sshfs).
The uhelper= (unprivileged umount helper) is possible to use when
non-root user wants to umount a mountpoint which is not defined in the
/etc/fstab file (e.g. devices mounted by udisk).
The helper= mount option redirects all umount requests to the
/sbin/umount.<helper> independently on UID.
/etc/mtab table of mounted file systems
- LIBMOUNT_FSTAB=<path>
- overrides the default location of the fstab file
- LIBMOUNT_MTAB=<path>
- overrides the default location of the mtab file
- LIBMOUNT_DEBUG=0xffff
- enables debug output
umount(2), mount(8), losetup(8)
A umount command appeared in Version 6 AT&T UNIX.