Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mount(2nfs)

mount(8)

umount(8)

mount(2)

Name

mount, umount − mount or unmount 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 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 mount 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 identifies the device that contains the file system that is to be unmounted. 

Environment

Programs compiled in the System V environment cause mount and umount 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. 

Return Value

The mount system call returns 0 upon successful completion of a mount operation; it returns −1 if the mount operation fails.

The umount system call announces to the system that the device dev no longer contains a 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.

Diagnostics

The mount 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 umount 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 mount(.).

[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 Also

mount(2nfs), mount(8), umount(8)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026