| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- unmount a file system
#include <sys/mount.h>intumount(const char *file);
intumount2(const char *file,intmflag);
Theumount() function requests that a previously mounted file system containedon a block special device or directory be unmounted. Thefileargument is a pointer to the absolute pathname of the file systemto be unmounted. After unmounting the file system, the directory upon which thefile system was mounted reverts to its ordinary interpretation.
Theumount2() function is identical toumount(), with the additional capabilityof unmounting file systems even if there are open files active. Themflag argument must contain one of the following values:
Perform a normal unmount that is equivalent toumount(). Theumount2() function returnsEBUSY if there are open files active within the file system to be unmounted.
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. Theumount2() function returnsENOTSUP if the specified file systems does not supportMS_FORCE. Only file systems of typenfs,ufs,pcfs, andzfs supportMS_FORCE.
Upon successful completion,0 is returned. Otherwise,-1 is returned anderrnois set to indicate the error.
Theumount() andumount2() functions will fail if:
The permission bits of the mount point do not permit read/write access or search permission is denied on a component 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.
A file onfile is busy.
The file pointed to byfile points to an illegal address.
The file pointed to byfile is not mounted.
Too many symbolic links were encountered in translating the path pointed to byfile.
The length of thefile argument exceedsPATH_MAX, or the length of afile component exceedsNAME_MAX while_POSIX_NO_TRUNC is in effect.
The file pointed to byfile does not exist or is not an absolute path.
The file pointed to byfile is on a remote machine and the link to that machine is no longer active.
The file pointed to byfile is not a block special device.
The {PRIV_SYS_MOUNT} privilege is not asserted in the effective set of the calling process.
The file pointed to byfile is remote.
Theumount2() function will fail if:
The file pointed to byfile does not support this operation.
Theumount() andumount2() functions can be invoked only by a processthat has the {PRIV_SYS_MOUNT} privilege asserted in its effective set.
Because it provides greater functionality, theumount2() function is preferred.
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |