MOUNT(2) System Calls Manual MOUNT(2)NAME
mount, umount - mount or remove file system
mount(special, name, rwflag)
char *special, *name;
Mount announces to the system that a removable file system has been mounted on the block-structured special file special; from now on, ref-
erences to file name will refer to the root file on the newly mounted file system. Special and name are pointers to null-terminated
strings containing the appropriate path names.
Name must exist already. Name must be a directory (unless the root of the mounted file system is not a directory). Its old contents are
inaccessible while the file system is mounted.
The rwflag argument determines whether the file system can be written on; if it is 0 writing is allowed, if non-zero no writing is done.
Physically write-protected and magnetic tape file systems must be mounted read-only or errors will occur when access times are updated,
whether or not any explicit write is attempted.
Umount announces to the system that the special file is no longer to contain a removable file system. The associated file reverts to its
SEE ALSO mount(1)DIAGNOSTICS
Mount returns 0 if the action occurred; -1 if special is inaccessible or not an appropriate file; if name does not exist; if special is
already mounted; if name is in use; or if there are already too many file systems mounted.
Umount returns 0 if the action occurred; -1 if if the special file is inaccessible or does not have a mounted file system, or if there are
active files in the mounted file system.
(mount = 21.)
sys mount; special; name; rwflag
(umount = 22.)
sys umount; special
Check Out this Related Man Page
mount(2) System Calls Manual mount(2)Name
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 containing 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 appropriate error.
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 environment.
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 superuser, 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 sys-
tem 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 operation; 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
The system call returns 0 if the dismount operation succeeds; -1 if it fails.
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 offline.
[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 associated hardware).
[EINVAL] The file system type is out of range.
[EINVAL] The super block for the file system had a bad magic number 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 characters.
[ELOOP] Too many symbolic links were encountered in translating either pathname.
[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 allocated 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 communications protocol.
See Alsomount(2nfs), mount(8), umount(8)mount(2)