mount, umount - mount or unmount a file system
mount(special, name, rwflag, type, options)
char *special, *name;
int rwflag, type;
The system call announces to the system that a file system has been
mounted on special file, special. References to file name refer to the
root file on the newly mounted file system.
The special argument is a pointer to a null-terminated string contain‐
ing the pathname of the file system being mounted.
The name argument is a pointer to a null-terminated string containing
the pathname of the root file on the newly mounted file system. The
name must already exist and must be a directory. Its old contents are
inaccessible while the file system is mounted.
The rwflag argument is used to determine whether the file system can be
written on; if it is 0, the file system is writable, if nonzero, the
file system is write-protected. Physically write-protected disks and
magnetic tape file systems must be mounted read-only. The call also
detects devices that are offline at mount time and returns the appro‐
The type argument identifies the file system type that is being
mounted. The file system types are defined in the <fs_types.h> file.
The options argument specifies certain parameters that can be used to
define how the file system is to be mounted.
The dev argument to is the device id and identifies the device that
contains the file system that is to be unmounted.
The type and the options arguments are not available in the System V
Programs compiled in the System V environment cause and to set errno to
ENOTDIR, instead of EPERM (illegal char in directory name) or EROFS
(directory on read only filesystem). If the process is not the supe‐
ruser, errno is set to EPERM, instead of ENODEV, and if the file does
not exist, errno is set to ENOENT, instead of ENODEV.
Also in the System V environment, only the low-order bit of rwflag is
checked to determine write permission.
In the System V environment the syntax for is as follows:
umount(name) char *name;
The argument to specifies the file system to be unmounted. In System V
mode, the argument is the of the device that contains the file system
that is to be unmounted; in all other modes, it is the device id.
The system call returns 0 upon successful completion of a mount opera‐
tion; it returns -1 if the mount operation fails.
The system call announces to the system that the device dev no longer
contains a file system. The associated directory reverts to its ordi‐
The system call returns 0 if the dismount operation succeeds; -1 if it
The call fails under the following conditions:
[EPERM] The caller is not the superuser.
[ENODEV] A component of special does not exist or the device is
[ENOTBLK] The special is not a block device.
[ENXIO] The major device number of special is out of range
(indicating that no device driver exists for the associ‐
[EINVAL] The file system type is out of range.
[EINVAL] The super block for the file system had a bad magic num‐
ber or an out-or-range block size.
[EINVAL] The file system has not been unmounted cleanly, and the
force option has not been set.
[ENOTDIR] A component of name is not a directory, or a path prefix
of special is already mounted.
[EBUSY] Another process currently holds a reference to name, or
special is already mounted.
[ENAMETOOLONG] A component of either pathname exceeded 255 characters,
or the entire length of either pathname exceeded 1023
[ELOOP] Too many symbolic links were encountered in translating
[ENOENT] A component of name does not exist.
[EMFILE] No space remains in the mount table.
[ENOMEM] Not enough memory was available to read the cylinder
group information for the file system.
[EIO] An I/O error occurred while reading the super block or
cylinder group information.
[EFAULT] The special or name points outside the process's allo‐
cated address space space.
[EROFS] The special is a write-locked device and the user did
not set the rwflag.
The command fails under the following conditions:
[EPERM] The caller is not the superuser.
[EINVAL] The requested device is not in the mount table.
[EBUSY] A process is holding a reference to a file located on
the file system.
[EIO] An I/O error occurred while writing the super block or
other cached file system information.
[EREMOTE] An attempt has been made to mount an NFS remote file
system that is not local to the specified server. This
cannot occur except in response to a failed
[ETIMEDOUT] A connect request or remote file operation failed
because the connected party did not properly respond
after a period of time that is dependent on the communi‐
See Alsomount(2nfs), mount(8), umount(8)mount(2)