Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

umount2(2) [sunos man page]

umount(2)							   System Calls 							 umount(2)

NAME
umount, umount2 - unmount a file system SYNOPSIS
#include <sys/mount.h> int umount(const char *file); int umount2(const char *file, int mflag); DESCRIPTION
The umount() function requests that a previously mounted file system contained on a block special device or directory be unmounted. The file argument is a pointer to the absolute pathname of the file system to be unmounted. After unmounting the file system, the directory upon which the file system was mounted reverts to its ordinary interpretation. The umount2() function is identical to umount(), with the additional capability of unmounting file systems even if there are open files active. The mflag argument must contain one of the following values: 0 Perform a normal unmount that is equivalent to umount(). The umount2() function returns EBUSY if there are open files active within the file system to be unmounted. MS_FORCE Unmount the file system, even if there are open files active. A forced unmount can result in loss of data, so it should be used only when a regular unmount is unsuccessful. The umount2() function returns ENOTSUP if the specified file systems does not support MS_FORCE. Currently only nfs- and ufs-type file systems support MS_FORCE. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The umount() and umount2() functions will fail if: EACCES The permission bits of the mount point do not permit read/write access or search permission is denied on a compo- nent of the path prefix. The calling process is not the owner of the mountpoint. The mountpoint is not a regular file or a directory and the caller does not have all privileges available in a its zone. The special device device does not permit read access in the case of read-only mounts or read-write access in the case of read/write mounts. EBUSY A file on file is busy. EFAULT The file pointed to by file points to an illegal address. EINVAL The file pointed to by file is not mounted. ELOOP Too many symbolic links were encountered in translating the path pointed to by file. ENAMETOOLONG The length of the file argument exceeds PATH_MAX, or the length of a file component exceeds NAME_MAX while _POSIX_NO_TRUNC is in effect. ENOENT The file pointed to by file does not exist or is not an absolute path. ENOLINK The file pointed to by file is on a remote machine and the link to that machine is no longer active. ENOTBLK The file pointed to by file is not a block special device. EPERM The {PRIV_SYS_MOUNT} privilege is not asserted in the effective set of the calling process. EREMOTE The file pointed to by file is remote. The umount2() function will fail if: ENOTSUP The file pointed to by file does not support this operation. USAGE
The umount() and umount2() functions can be invoked only by a process that has the {PRIV_SYS_MOUNT} privilege asserted in its effective set. Because it provides greater functionality, the umount2() function is preferred. SEE ALSO
mount(2), privileges(5) SunOS 5.10 22 Mar 2004 umount(2)

Check Out this Related Man Page

UMOUNT(2)						     Linux Programmer's Manual							 UMOUNT(2)

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 system 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 behav- ior 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 currently 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 programs 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.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2010-06-19 UMOUNT(2)
Man Page