mount, umount - Mount or unmount a file system
#include <sys/mount.h>
int mount(
int type,
char *mnt-path,
int mnt_flags,
caddr_t data ); int umount(
char *mnt-path,
int umnt_flag );
Defines the type of the file system. The types of recognized
file systems are: Reserved for third-party file systems.
See NOTES for information about support for thirdparty
file systems. For internal use only. For internal
use only. For internal use only. Compact Disk File System
(see cdfs(4)) Distributed File System (layered product)
Versatile Disk File System (see dvdfs(4)) DCE Episode
File System (layered product) File Descriptor File System
(used by streams) File on File Mounting File System (used
by streams) Memory File System (RAM disk) Advanced File
System (AdvFS) Network File System, Version 2 protocol
Network File System, Version 3 protocol PC File System
/proc File System (used by debuggers) System V File System
Berkeley's UNIX File System Points to a null-terminated
string that contains the appropriate pathname. Specifies
which semantics should be used when accessing the file
system. One or more of the following flags might be valid,
depending on the file system type and flag combination:
Cause all files in the mounted AdvFS fileset to use
atomic-write data logging. (See the description of the adl
argument for the mount command's -o option in mount(8).)
For internal use only. For UFS, flush data asynchronously
rather than synchronously. For information about the
advantages and risks of using this flag, see the discussion
of the delayed keyword for the mount command's -o
option in mount(8). For internal use only. Allow an
AdvFS fileset to be mounted as a domain volume even though
it has the same AdvFS domain ID as a fileset that is
already mounted. Allow the file system to be exported for
both read and write access. Allow the file system to be
exported for read-only access. For UFS and AdvFS, extend
the size of the file system to use all the available storage
space in a revised partition. The file system must be
already mounted in order to use this option. For internal
use only. Forcibly mount the file system, even if it is
unclean. In a cluster, enable cluster partitioning, which
restricts use of the file system to the member that mounts
it. This flag cannot be used on a file system that is
already mounted.
This flag is automatically set when mounting a UNIX
file system (UFS) for read-write access and when
mounting an in-memory file system (MFS). For
internal use only. All new files and directories
inherit the group ID of the parent directory.
When this flag is not specified, the following SVID
III semantics apply: If the parent directory's mode
bits include the IS_GID, then the group ID of the
new file or directory is the parent directory's
group ID. If the parent directory's mode bits do
not include IS_GID, then the group ID of the new
file or directory is the process group ID of the
creating process. For internal use only. For
internal use only. Obsolete; not used. For internal
use only. Mark the file access time changes
made for reads of regular files in memory, but do
not flush them to disk until other file modifications
occur. This behavior does not comply with
industry standards and is used to reduce disk
writes for applications with no dependencies on
file access times. Do not allow access from the
file system to either block- or character-special
devices. Do not allow files to be executed from
the file system. Do not honor setuid or setgid
bits on files when executing them. For AdvFS and
UFS, enable quotas on the file system. 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.
Obsolete; not used. For AdvFS and UFS, enable an
alternate smooth sync policy wherein dirty UBC
pages are flushed to disk after the smoothsync_age
period, but only if they are idle for the smoothsync_age
period. By default, dirty UBC pages are
written to disk after the smoothsync_age period,
regardless of whether they are still being modified.
This policy can be applied only to dirty pages in
the file system cache (UBC); dirty pages mapped
into virtual memory are always flushed to disk
after the smoothsync_age period, even if they are
still being modified.
The smoothsync_age system attribute can be configured
by means of the /sbin/sysconfig command. See
sys_attrs_vfs(5) and sysconfig(8) for information
about the smoothsync_age attribute and
/sbin/sysconfig command, respectively. For AdvFS
and UFS, cause all writes to be written to disk as
well as to the buffer cache before the function
performing the write operation returns. By default,
write operations to disk are done asynchronously of
write operations to the buffer cache. For AdvFS
and UFS, prevent excessive asynchronous I/O from
overloading the device queue. This flag has no
effect if M_SYNCHRONOUS is applied to the file system.
For internal use only. See M_THROTTLE. The
mount operation is being performed on an already
mounted file system. This flag allows mount
attributes to be changed without unmounting and
remounting the file system.
The attributes that can be changed for a mounted
file system are restricted by most types of file
system software. For example, for most types of
file systems, you cannot change the access mode
from read-write to read-only if the file system is
already mounted.
For UFS or AdvFS, M_UPDATE is typically specified
without M_RDONLY to change a file system that had
been mounted read-only to read-write. If M_UPDATE
is used in a cluster environment, it is important
to remember that while AdvFS filesets can be
mounted read-write and be accessible to all cluster
members, UFS file systems must be mounted read-only
to be available to all cluster members. For UFS,
any attempt to use M_UPDATE on a file system that
is already mounted read-only and accessible to all
cluster members will fail. Points to a structure
that contains the type-specific parameters to
mount. May be 0 (zero) or the following: Performs
a fast unmount that causes remote file systems to
be unmounted without notifying the server.
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. The file specified by
the data parameter cannot be a directory file; otherwise
either file may be of any type. The 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) mounts, to call either the mount() or umount() function,
the calling process must have superuser privilege.
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.
Third-party file systems do not have type constants
defined in the <sys/mount.h> file. For these file systems,
functionality has been added to the mount() function to
allow an application to query by using the file system's
name string to obtain the corresponding type numeric
value. The type numeric value obtained from the first
mount() call can then be used in a second mount() call to
mount the third-party file system.
To use the type query functionality, call mount() 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 must be set to the
file system name string to search for and the second field
is a return index. If the specified name string is found,
the function returns the corresponding type numeric value
into the structure's return index field.
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.
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 AdvFS, the mount can fail if the domain or fileset (or
both) specified in the data parameter does not exist or is
inaccessible.
For 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
system wide 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.
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. The file system is invalid or not installed. A
component of the mnt-path parameter does not exist. The
specified mnt-path 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 mntpath
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 process is attempting
to mount on a multilevel child directory.
The following errors can occur for a UFS file system
mount: 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.
/usr/include/sys/mount.h
Functions: mount(2sv)
Commands: mount(8)
mount(2)
[ Back ] |