1umount(2)                        System Calls                        umount(2)
2
3
4

NAME

6       umount, umount2 - unmount a file system
7

SYNOPSIS

9       #include <sys/mount.h>
10
11       int umount(const char *file);
12
13
14       int umount2(const char *file, int mflag);
15
16

DESCRIPTION

18       The  umount()   function requests that a previously mounted file system
19       contained on a block special device or  directory  be  unmounted.   The
20       file  argument is a pointer to the absolute pathname of the file system
21       to be unmounted. After unmounting the file system, the  directory  upon
22       which  the  file system was mounted reverts to its ordinary interpreta‐
23       tion.
24
25
26       The umount2()  function is identical to umount(), with  the  additional
27       capability  of  unmounting  file  systems  even if there are open files
28       active. The mflag argument must contain one of the following values:
29
30       0           Perform a normal unmount that is  equivalent  to  umount().
31                   The  umount2()  function   returns  EBUSY if there are open
32                   files active within the file system to be unmounted.
33
34
35       MS_FORCE    Unmount the file system,  even  if  there  are  open  files
36                   active.  A forced unmount can result in loss of data, so it
37                   should be used only when a regular unmount is unsuccessful.
38                   The  umount2()  function   returns ENOTSUP if the specified
39                   file systems does not support MS_FORCE. Only  file  systems
40                   of type nfs, ufs, pcfs, and zfs support MS_FORCE.
41
42

RETURN VALUES

44       Upon  successful  completion,  0 is returned. Otherwise, −1 is returned
45       and errno is set to indicate the error.
46

ERRORS

48       The umount() and umount2() functions will fail if:
49
50       EACCES          The permission bits of the mount point  do  not  permit
51                       read/write  access  or search permission is denied on a
52                       component of the path prefix.
53
54                       The calling process is not the owner of the mountpoint.
55
56                       The mountpoint is not a regular file or a directory and
57                       the  caller does not have all privileges available in a
58                       its zone.
59
60                       The special device device does not permit  read  access
61                       in the case of read-only mounts or read-write access in
62                       the case of read/write mounts.
63
64
65       EBUSY           A file on file is busy.
66
67
68       EFAULT          The file pointed  to  by  file  points  to  an  illegal
69                       address.
70
71
72       EINVAL          The file pointed to by file is not mounted.
73
74
75       ELOOP           Too many symbolic links were encountered in translating
76                       the path pointed to by file.
77
78
79       ENAMETOOLONG    The length of the file argument exceeds   PATH_MAX,  or
80                       the  length of a  file component exceeds NAME_MAX while
81                       _POSIX_NO_TRUNC is in effect.
82
83
84       ENOENT          The file pointed to by file does not exist or is not an
85                       absolute path.
86
87
88       ENOLINK         The  file pointed to by file is on a remote machine and
89                       the link to that machine is no longer active.
90
91
92       ENOTBLK         The file pointed to by file  is  not  a  block  special
93                       device.
94
95
96       EPERM           The  {PRIV_SYS_MOUNT}  privilege is not asserted in the
97                       effective set of the calling process.
98
99
100       EREMOTE         The file pointed to by file is remote.
101
102
103
104       The umount2() function will fail if:
105
106       ENOTSUP    The file pointed to by file does not support this operation.
107
108

USAGE

110       The umount() and umount2() functions can be invoked only by  a  process
111       that has the {PRIV_SYS_MOUNT} privilege asserted in its effective set.
112
113
114       Because  it  provides  greater functionality, the umount2() function is
115       preferred.
116

SEE ALSO

118       mount(2), privileges(5)
119
120
121
122SunOS 5.11                        4 Aug 2008                         umount(2)
Impressum