.\" Copyright (c) 1980, 1989 The Regents of the University of California.
.\" %sccs.include.redist.man%
.\" @(#)mount.2 8.1 (Berkeley) %G%
.Nd mount or dismount a filesystem
.Fd #include <sys/mount.h>
.Fn mount "int type" "const char *dir" "int flags" "caddr_t data"
.Fn unmount "const char *dir" "int flags"
a filesystem object onto the system file tree
describes the filesystem object to be mounted.
tells the kernel how to interpret
The contents of the filesystem
become available through the new mount point
of a successful mount are swept under the carpet so to speak, and
are unavailable until the filesystem is unmounted.
suppress default semantics which affect filesystem access.
.Bl -tag -width M_SYNCHRONOUS
The file system should be treated as read-only;
Even the super-user may not write on it.
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.
indicates that 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.
Some file systems may not allow all flags to be changed.
most file systems will not allow a change from read-write to read-only.
argument defines the type of the file system.
The types of file systems known to the system are defined in
is a pointer to a structure that contains the type
specific arguments to mount.
The currently supported types of file systems and
their type specific data are:
.Bd -literal -offset indent -compact
char *fspec; /* Block special file to mount */
int exflags; /* export related flags */
uid_t exroot; /* mapping for root uid */
.Bd -literal -offset indent -compact
struct sockaddr_in *addr; /* file server address */
nfsv2fh_t *fh; /* File handle to be mounted */
int wsize; /* write size in bytes */
int rsize; /* read size in bytes */
int timeo; /* initial timeout 0.1 secs */
int retrans; /* times to retry send */
char *hostname; /* server's name */
.Bd -literal -offset indent -compact
char *name; /* name of backing process */
caddr_t base; /* base address of the file system */
u_long size; /* size of the file system */
function call disassociates the filesystem from the specified
argument may have one of the following values:
.Bl -tag -width M_SYNCHRONOUS
The unmount should fail if any files are active on the file system.
The file system should be forcibly unmounted even if files are
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.
returns the value 0 if the mount was successful, otherwise -1 is returned
is set to indicate the error.
returns the value 0 if the umount succeeded; otherwise -1 is returned
is set to indicate the error.
will fail when one of the following occurs:
.Bl -tag -width [ENOTBLK]
The caller is not the super-user.
A component of a pathname exceeded 255 characters,
or the entire length of a path name exceeded 1023 characters.
Too many symbolic links were encountered in translating a pathname.
A pathname contains a character with the high-order bit set.
Another process currently holds a reference to
points outside the process's allocated address space.
The following errors can occur for a
.Bl -tag -width [ENOTBLK]
The major device number of
is out of range (this indicates no device driver exists
for the associated hardware).
No space remains in the mount table.
The super block 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 super block or
cylinder group information.
points outside the process's allocated address space.
The following errors can occur for a
.Bl -tag -width [ENOTBLK]
timed out trying to contact the server.
Some part of the information described by nfs_args
points outside the process's allocated address space.
The following errors can occur for a
.Bl -tag -width [ENOTBLK]
No space remains in the mount table.
The super block 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 paging error occurred while reading the super block or
cylinder group information.
points outside the process's allocated address space.
may fail with one of the following errors:
.Bl -tag -width [ENOTBLK]
The caller is not the super-user.
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 255 characters,
or an entire path name exceeded 1023 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
An I/O error occurred while writing cached file system information.
points outside the process's allocated address space.
mount can also fail if the maximum number of filesystems are currently
Some of the error codes need translation to more obvious messages.
function calls appeared in Version 6 AT&T UNIX.