mount(2)
NAME
mount, umount − mount or remove a file system
SYNTAX
#include <sys/types.h>
#include <sys/fs_types.h>
mount(special, name, rwflag, type, options)
char *special, *name;
int rwflag, type;
char *options;
umount(dev)
dev_t dev;
DESCRIPTION
The mount system call announces to the system that a removable 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 mount system call returns 0 upon successful completion of a mount operation; it returns −1 if the mount operation fails. The mount operation fails when:
•The file special is inaccessible or an inappropriate file.
•The file special is already mounted.
•The directory name does not exist or is already in use.
•There are too many file systems mounted.
The umount system call announces to the system that the device dev no longer contains a removable file system. The associated directory reverts to its ordinary interpretation.
The umount system call returns 0 if the dismount operation succeeds; −1 if it fails. The file system dismount operation fails when:
•The device dev is inaccessible or does not have a mounted file system.
•There are active files in the mounted file system.
The special argument is a pointer to a null-terminated string containing the path name of the file system being mounted.
The name argument is a pointer to a null-terminated string containing the path name 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 non-zero, the file system is write-protected. Physically write-protected disks and magnetic tape file systems must be mounted read-only. Mount 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 identifies the device that contains the file system which is to be unmounted.
ENVIRONMENT
Programs compiled using the System V environment, cause mount and umount to set errno to ENXIO rather than ENODEV, if special does not exist.
DIAGNOSTICS
[EPERM] The caller is not the super-user.
[ENODEV] A component of special does not exist or the device is offline.
[ENOTBLK] Special is not a block device.
[ENXIO] The major device number of special is out of range (this indicates no device driver exists for the associated hardware).
[EINVAL] Either pathname contains a character with the high-order bit set or 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] Special or name points outside the process’s allocated address space space.
[EROFS] Special is a write-locked device and the user did not set the rwflag.
The umount command may fail with one of the following errors:
[EPERM] The caller is not the super-user.
[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 mouunt an NFS remote file system that is not local to the specified server. This cannot occur except in response to a failed mount(2).
[ETIMEDOUT] A "connect" request or remote file operation failed because the connected party did not properly respond after a period of time which is dependent on the communications protocol.