man-pages/man8/umount.8.html
2021-03-31 01:06:50 +01:00

378 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of UMOUNT</TITLE>
</HEAD><BODY>
<H1>UMOUNT</H1>
Section: System Administration (8)<BR>Updated: July 2014<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
umount - unmount file systems
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>umount -a</B>
[<B>-dflnrv</B>]
[<B>-t</B>
<I>fstype</I>]
[<B>-O</B>
<I>option</I>...]
<P>
<B>umount</B>
[<B>-dflnrv</B>]
{<I>directory</I>|<I>device</I>}...
<P>
<B>umount</B>
<B>-h</B>|<B>-V</B>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>umount</B>
command detaches the mentioned file system(s) 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.
<P>
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
<B>umount</B>
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 <B>--lazy</B> description below.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-a</B>,<B> --all</B>
<DD>
All of the filesystems described in
<I>/proc/self/mountinfo</I>
(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 <B>--types</B>
umount option.
<DT id="2"><B>-A</B>,<B> --all-targets</B>
<DD>
Unmount all mountpoints in the current 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 <B>--recursive</B>, 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.
<DT id="3"><B>-c</B>,<B> --no-canonicalize</B>
<DD>
Do not canonicalize paths. The paths canonicalization is based on
<B><A HREF="/cgi-bin/man/man2html?2+stat">stat</A></B>(2)
and
<B><A HREF="/cgi-bin/man/man2html?2+readlink">readlink</A></B>(2)
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.
<P>
For more details about this option see the
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
man page. Note that <B>umount</B> does not pass this option to the
<B>/sbin/umount.</B><I>type</I>
helpers.
<DT id="4"><B>-d</B>,<B> --detach-loop</B>
<DD>
When the unmounted device was a loop device, also free this loop
device. This option is unnecessary for devices initialized by
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8),
in this case &quot;autoclear&quot; functionality is enabled by default.
<DT id="5"><B>--fake</B>
<DD>
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
<I>/etc/mtab</I>
that were unmounted earlier with the
<B>-n</B>
option.
<DT id="6"><B>-f</B>,<B> --force</B>
<DD>
Force an unmount (in case of an unreachable NFS system).
<P>
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.
<DT id="7"><B>-i</B>,<B> --internal-only</B>
<DD>
Do not call the <B>/sbin/umount.</B><I>filesystem</I> helper even if it exists.
By default such a helper program is called if it exists.
<DT id="8"><B>-l</B>,<B> --lazy</B>
<DD>
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.
<P>
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 <B>umount -l</B> 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.
<P>
<DT id="9"><B>-N</B>,<B> --namespace </B><I>ns</I>
<DD>
Perform umount in namespace specified by <I>ns</I>.
<I>ns</I> is either PID of process running in that namespace
or special file representing that namespace.
<P>
<B><A HREF="/cgi-bin/man/man2html?8+umount">umount</A></B>(8)
switches to the namespace when it reads /etc/fstab, writes /etc/mtab (or writes to /run/mount) and calls
<B><A HREF="/cgi-bin/man/man2html?2+umount">umount</A></B>(2)
system call, otherwise it runs in the original namespace. It means that the target namespace does not have
to contain any libraries or another requirements necessary to execute
<B><A HREF="/cgi-bin/man/man2html?2+umount">umount</A></B>(2)
command.
<P>
See <B><A HREF="/cgi-bin/man/man2html?7+namespaces">namespaces</A></B>(7) for more information.
<DT id="10"><B>-n</B>,<B> --no-mtab</B>
<DD>
Unmount without writing in
<I>/etc/mtab</I>.
<DT id="11"><B>-O</B>,<B> --test-opts </B><I>option</I>...
<DD>
Unmount only the filesystems that have the specified option set in
<I>/etc/fstab</I>.
More than one option may be specified in a comma-separated list.
Each option can be prefixed with
<B>no</B>
to indicate that no action should be taken for this option.
<DT id="12"><B>-q</B>,<B> --quiet</B>
<DD>
Suppress &quot;not mounted&quot; error messages.
<DT id="13"><B>-R</B>,<B> --recursive</B>
<DD>
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.
<DT id="14"><B>-r</B>,<B> --read-only</B>
<DD>
When an unmount fails, try to remount the filesystem read-only.
<DT id="15"><B>-t</B>,<B> --types </B><I>type</I>...
<DD>
Indicate that the actions should only be taken on filesystems of the
specified
<I>type</I>.
More than one type may be specified in a comma-separated list. The list
of filesystem types can be prefixed with
<B>no</B>
to indicate that no action should be taken for all of the mentioned types.
Note that
<B>umount</B>
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. &quot;nfs4&quot; vs. &quot;nfs&quot;).
<DT id="16"><B>-v</B>,<B> --verbose</B>
<DD>
Verbose mode.
<DT id="17"><B>-V</B>,<B> --version</B>
<DD>
Display version information and exit.
<DT id="18"><B>-h</B>,<B> --help</B>
<DD>
Display help text and exit.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>LOOP DEVICE</H2>
The
<B>umount</B>
command will automatically detach loop device previously initialized by
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
command independently of /etc/mtab.
<P>
In this case the device is initialized with &quot;autoclear&quot; flag (see
<B><A HREF="/cgi-bin/man/man2html?8+losetup">losetup</A></B>(8)
output for more details), otherwise it's necessary to use the option <B> --detach-loop</B>
or call <B>losetup -d &lt;device&gt;</B>. The autoclear feature is supported since Linux 2.6.25.
<A NAME="lbAG">&nbsp;</A>
<H2>EXTERNAL HELPERS</H2>
The syntax of external unmount helpers is:
<P>
<DL COMPACT><DT id="19"><DD>
<B>umount.</B><I>suffix</I>
{<I>directory</I>|<I>device</I>}
[<B>-flnrv</B>]
[<B>-N</B>
<I>namespace</I>]
[<B>-t</B>
<I>type</I>.<I>subtype</I>]
</DL>
<P>
where <I>suffix</I> is the filesystem type (or the value from a
<B>uhelper=</B> or <B>helper=</B> marker in the mtab file).
The <B>-t</B> option can be used for filesystems that
have subtype support. For example:
<P>
<DL COMPACT><DT id="20"><DD>
<B>umount.fuse -t fuse.sshfs</B>
</DL>
<P>
A <B>uhelper=</B><I>something</I> marker (unprivileged helper) can appear in
the <I>/etc/mtab</I> file when ordinary users need to be able to unmount
a mountpoint that is not defined in <I>/etc/fstab</I>
(for example for a device that was mounted by <B><A HREF="/cgi-bin/man/man2html?1+udisks">udisks</A></B>(1)).
<P>
A <B>helper=</B><I>type</I> marker in the mtab file will redirect
all unmount requests
to the <B>/sbin/umount.</B><I>type</I> helper independently of UID.
<P>
Note that <I>/etc/mtab</I> is currently deprecated and helper= and another
userspace mount options are maintained by libmount.
<A NAME="lbAH">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="21"><I>/etc/mtab</I>
<DD>
table of mounted filesystems (deprecated and usually replaced by
symlink to /proc/mounts)
<DT id="22"><I>/etc/fstab</I>
<DD>
table of known filesystems
<DT id="23"><I>/proc/self/mountinfo</I>
<DD>
table of mounted filesystems generated by kernel.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="24">LIBMOUNT_FSTAB=&lt;path&gt;<DD>
overrides the default location of the fstab file (ignored for suid)
<DT id="25">LIBMOUNT_MTAB=&lt;path&gt;<DD>
overrides the default location of the mtab file (ignored for suid)
<DT id="26">LIBMOUNT_DEBUG=all<DD>
enables libmount debug output
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+umount">umount</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?8+losetup">losetup</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
<A NAME="lbAK">&nbsp;</A>
<H2>HISTORY</H2>
A
<B>umount</B>
command appeared in Version 6 AT&amp;T UNIX.
<A NAME="lbAL">&nbsp;</A>
<H2>AVAILABILITY</H2>
The umount command is part of the util-linux package and is available from
Linux Kernel Archive
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="27"><A HREF="#lbAB">NAME</A><DD>
<DT id="28"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="29"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="30"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="31"><A HREF="#lbAF">LOOP DEVICE</A><DD>
<DT id="32"><A HREF="#lbAG">EXTERNAL HELPERS</A><DD>
<DT id="33"><A HREF="#lbAH">FILES</A><DD>
<DT id="34"><A HREF="#lbAI">ENVIRONMENT</A><DD>
<DT id="35"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="36"><A HREF="#lbAK">HISTORY</A><DD>
<DT id="37"><A HREF="#lbAL">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:18 GMT, March 31, 2021
</BODY>
</HTML>