Sei sulla pagina 1di 4

File: *manpages*, Node: umount, Up: (dir) UMOUNT(8) System Administration UMOUNT(8)

NAME umount - unmount file systems SYNOPSIS umount [-hV] umount -a [-dflnrv] [-t vfstype] [-O options] umount [-dflnrv] {dir|device}... DESCRIPTION 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. Options for the umount command: -V -h -v -n -r -d -i Print version and exit. Print help message and exit. Verbose mode. Unmount without writing in /etc/mtab. In case unmounting fails, try to remount read-only. In case the unmounted device was a loop device, also free this loop device. Don't call the /sbin/umount.<filesystem> helper even if it exists. By default /sbin/umount.<filesystem> helper is called if one exists. All of the file systems described in /etc/mtab are unmounted. (With umount version 2.7 and later: the proc filesystem is not unmounted.)


-t vfstype 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 pre fixed with no to specify the file system types on which no action should be taken. -O options

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. -f -l Force unmount (in case of an unreachable NFS system). (Requires kernel 2.1.116 or later.) Lazy unmount. Detach the filesystem from the filesystem hierar chy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

--no-canonicalize Don't canonicalize paths. For more details about this option see the mount(8) man page. --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. THE LOOP DEVICE The umount command will free the loop device (if any) associated with the mount, in case it finds the option `loop=...' in /etc/mtab, or when the -d option was given. Any pending loop devices can be freed using `losetup -d', see losetup(8). NOTES 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 nonroot 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. FILES /etc/mtab table of mounted file systems SEE ALSO umount(2), mount(8), losetup(8). HISTORY A umount command appeared in Version 6 AT&T UNIX. AVAILABILITY The umount command is part of the util-linux package and is available


util-linux UMOUNT(2)

March 2010 Linux Programmer's Manual


NAME umount, umount2 - unmount file system SYNOPSIS #include <sys/mount.h> int umount(const char *target); int umount2(const char *target, int flags); DESCRIPTION umount() and umount2() remove the attachment of the (topmost) file sys tem mounted on target. Appropriate privilege (Linux: the CAP_SYS_ADMIN capability) is required to unmount file systems. 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, 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 cur rently 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 pro grams that allow unprivileged users to unmount file systems. RETURN VALUE On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS The error values given below result from file-system type independent errors. Each file system type may have its own special errors and its

own special behavior. See the kernel source code for details. EAGAIN A call to umount2() specifying MNT_EXPIRE successfully marked an unbusy file system 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. Or, umount2() was called with MNT_EXPIRE and either MNT_DETACH or MNT_FORCE. ENAMETOOLONG 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. VERSIONS MNT_DETACH and MNT_EXPIRE are only available in glibc since version 2.11. CONFORMING TO These functions are Linux-specific and should not be used in programs intended to be portable. NOTES 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). SEE ALSO mount(2), path_resolution(7), mount(8), umount(8) COLOPHON This page is part of release 3.41 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at