Content-type: text/html Man page of mount

mount

Section: System Calls (2)
Index Return to Main Contents
 

NAME

mount, umount - Mounts or unmounts a file system  

SYNOPSIS

#include <sys/mount.h>

mount(        int type,
       char *mnt-path,
       int mnt_flag,
       caddr_t data );

umount(        char *mnt-path,
       int umnt_flag );
 

PARAMETERS

Defines the type of the file system. The types of recognized file systems are: Berkeley's UNIX File System Network File System, Version 2 protocol Memory File System (RAM disk) Compact Disk File System (see cdfs(4)) Distributed File System (layered product) DCE Episode File System (layered product) /proc File System (used by debuggers) Advanced File System (AdvFS) File on File (used by streams) File Descriptor File System (used by streams) Reserved for third-party file systems Network File System, Version 3 protocol Points to a null-terminated string that contains the appropriate pathname. Specifies which semantics should be used when accessing the file system. Valid flags are: The file system should be treated as read only; no writing is allowed (even by a process with appropriate privilege). 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. Do not allow files to be executed from the file system. Do not honor setuid or setgid bits on files when executing them. Do not interpret special files on the file system. All I/O to the file system should be done synchronously. Forcibly mount, even if the file system is unclean. The mount command is being applied to an already mounted file system. This allows the mount flags to be changed without requiring that the file system be unmounted and remounted. All new files and directories will inherit the group ID of the parent. When this is not specified, SVID III semantics apply, for example, if the parent directory's mode bits include the parent's group ID. If IS_GID is off, then it inherits the processes group ID.

Some file systems may not allow all flags to be changed. For example, most file systems do not allow a change from read/write to read only. Points to a structure that contains the type-specific parameters to mount. Specifies one of the following values: The file system should be forcibly umounted even if files are still active. Active special devices continue to work, but any further accesses to any other active files result in errors even if the file system is later remounted. Support for a forcible unmount is file system dependent.
 

DESCRIPTION

Except in the case of file-on-file mounting, the mount() function mounts a file system on the directory pointed to by the mnt-path parameter. Following the mount, references to mnt-path refer to the root of the newly mounted file system.

The mnt-path parameter must point to a directory or file that already exists.

For file-on-file mounting, the mount() function mounts a file specified by the data parameter onto another file specified by the mnt-path parameter. Either file may be of any type, but mnt-path cannot already have a file system or another file mounted on it.

The umount() function unmounts a file system mounted at the directory pointed to by the mnt-path parameter. The associated directory reverts to its ordinary interpretation.

Except for file-on-file mounting and Network File System (NFS) file system mounts, to call either the mount() or umount() function, the calling process must have superuser privilege.  

RESTRICTIONS

The mount function supports mount point argument pathnames of up to MNAMELEN, which includes the null terminating character. MNAMELEN can be up to 90 characters long, including the null terminating character.  

NOTES

Two mount() functions are supported by Tru64 UNIX: the BSD mount() and the System V mount(). The default mount() function is the BSD mount() documented on this reference page. The operating system does not support the System V lmount function.

For third-party file system support, functionality has been added to query the mount command by file system name in order to obtain the corresponding file system type. Once the file system type is obtained, it can then be used in a standard call to the mount command to mount the file system.

To access this functionality, invoke the mount command with type as -1, mnt_path as NULL, mnt_flag as 0, and data pointing to the address of a vfsops_fsname_args structure. This structure is defined in the sys/mount.h file and contains two fields; the first field is a string representing the file system name to search for, the second field is a return index. If the specified file system name is found, the structure's return index field will be set to the corresponding type.  

RETURN VALUES

The mount() function returns 0 (zero) if the file system was successfully mounted. Otherwise, -1 is returned. The mount can fail if the mnt-path parameter does not exist or is of the wrong type.

For an Advanced File System (AdvFS), the mount can fail if the domain or fileset (or both) specified in the data parameter does not exist or is inaccessible.

For a UNIX File System (UFS), the mount can fail if the special device specified in the ufs_args structure is inaccessible, is not an appropriate file, or is already mounted. The same failure can occur for a PROCFS file system. A mount can also fail if there are already too many file systems mounted, either systemwide or for a specific file system type.

For the query by name functionality (for third-party file systems), the mount() function returns 0 (zero) if the file system name was found; otherwise, -1 is returned.

The umount() function returns 0 (zero) if the file system was successfully unmounted. Otherwise, -1 is returned. The unmount will fail if there are active files in the mounted file system, unless the MNT_FORCE flag is set and the file system supports forcible unmounting.  

ERRORS

If the mount() function fails, errno may be set to one of the following values: The caller does not have appropriate privilege. A component of a pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX characters. Too many symbolic links were encountered in translating a pathname. No space remains in the mount table. A component of the mnt-path parameter does not exist. A component of the name parameter is not a directory, or a path prefix of the special parameter is not a directory. A pathname contains a character with the high-order bit set, or the file system name in the query by name functionality is invalid. Another process currently holds a reference to the mnt-path parameter. The file system is not clean and M_FORCE is not set. The mnt-path parameter points outside the process' allocated address space.

The following errors can occur for a UFS file system mount: A component of ufs_args fspec does not exist. The fspec field is not a block device. The major device number of fspec is out of range (this indicates no device driver exists for the associated hardware). The device pointed to by the fspec field is already mounted. The superblock for the file system had a bad magic number or an out-of-range block size. Not enough memory was available to read the cylinder group information for the file system. An I/O error occurred while reading the superblock or cylinder group information. The fspec field points outside the process' allocated address space.

The following errors can occur for an NFS-compatible file system mount: NFS timed out trying to contact the server. Some part of the information described by nfs_args points outside the process' allocated address space.

The following errors can occur for a PROCFS file system mount: The device pointed to by the fspec field is already mounted. No space remains in the mount table. The fspec field points outside the process's allocated address space. Free vnodes are not available. Memory is insufficient for the /proc directory table.

If the umount() function fails, errno may be set to one of the following values: The caller does not have appropriate privilege. A component of the path is not a directory. The pathname contains a character with the high-order bit set. A component of a pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX characters. Too many symbolic links were encountered in translating the pathname. The requested directory is not in the mount table. A process is holding a reference to a file located on the file system. An I/O error occurred while writing cached file system information. The mnt-path parameter points outside the process' allocated address space.  

FILES

/usr/include/sys/mount.h  

RELATED INFORMATION

Functions: mount(2sv)

Commands: mount(8) delim off


 

Index

NAME
SYNOPSIS
PARAMETERS
DESCRIPTION
RESTRICTIONS
NOTES
RETURN VALUES
ERRORS
FILES
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:14 GMT, October 02, 2010