BSD 4_4 development
[unix-history] / usr / share / man / cat2 / unmount.0
MOUNT(2) BSD Programmer's Manual MOUNT(2)
N\bNA\bAM\bME\bE
m\bmo\bou\bun\bnt\bt, u\bun\bnm\bmo\bou\bun\bnt\bt - mount or dismount a filesystem
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/p\bpa\bar\bra\bam\bm.\b.h\bh>\b>
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/m\bmo\bou\bun\bnt\bt.\b.h\bh>\b>
_\bi_\bn_\bt
m\bmo\bou\bun\bnt\bt(_\bi_\bn_\bt _\bt_\by_\bp_\be, _\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs, _\bc_\ba_\bd_\bd_\br_\b__\bt _\bd_\ba_\bt_\ba);
_\bi_\bn_\bt
u\bun\bnm\bmo\bou\bun\bnt\bt(_\bc_\bo_\bn_\bs_\bt _\bc_\bh_\ba_\br _\b*_\bd_\bi_\br, _\bi_\bn_\bt _\bf_\bl_\ba_\bg_\bs);
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The m\bmo\bou\bun\bnt\bt() function grafts a filesystem object onto the system file tree
at the point _\bd_\bi_\br. The argument _\bd_\ba_\bt_\ba describes the filesystem object to be
mounted. The argument _\bt_\by_\bp_\be tells the kernel how to interpret _\bd_\ba_\bt_\ba (See
_\bt_\by_\bp_\be below). The contents of the filesystem become available through the
new mount point _\bd_\bi_\br. Any files in _\bd_\bi_\br at the time of a successful mount
are swept under the carpet so to speak, and are unavailable until the
filesystem is unmounted.
The following _\bf_\bl_\ba_\bg_\bs may be specified to suppress default semantics which
affect filesystem access.
MNT_RDONLY The filesystem should be treated as read-only; Even the
super-user may not write on it.
MNT_NOEXEC Do not allow files to be executed from the filesystem.
MNT_NOSUID Do not honor setuid or setgid bits on files when execut-
ing them.
MNT_NODEV Do not interpret special files on the filesystem.
MNT_SYNCHRONOUS All I/O to the filesystem should be done synchronously.
The flag MNT_UPDATE indicates that the mount command is being applied to
an already mounted filesystem. This allows the mount flags to be changed
without requiring that the filesystem be unmounted and remounted. Some
filesystems may not allow all flags to be changed. For example, most
filesystems will not allow a change from read-write to read-only.
The _\bt_\by_\bp_\be argument defines the type of the filesystem. The types of
filesystems known to the system are defined in <_\bs_\by_\bs_\b/_\bm_\bo_\bu_\bn_\bt_\b._\bh>. _\bD_\ba_\bt_\ba is a
pointer to a structure that contains the type specific arguments to
mount. The currently supported types of filesystems and their type spe-
cific data are:
MOUNT_UFS
struct ufs_args {
char *fspec; /* Block special file to mount */
int exflags; /* export related flags */
uid_t exroot; /* mapping for root uid */
};
MOUNT_NFS
struct nfs_args {
struct sockaddr_in *addr; /* file server address */
nfsv2fh_t *fh; /* File handle to be mounted */
int flags; /* flags */
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 */
};
MOUNT_MFS
struct mfs_args {
char *name; /* name of backing process */
caddr_t base; /* base address of the filesystem */
u_long size; /* size of the filesystem */
};
The u\bum\bmo\bou\bun\bnt\bt() function call disassociates the filesystem from the speci-
fied mount point _\bd_\bi_\br.
The _\bf_\bl_\ba_\bg_\bs argument may specify MNT_FORCE to specify that the filesystem
should be forcibly unmounted even if files are still active. Active spe-
cial devices continue to work, but any further accesses to any other ac-
tive files result in errors even if the filesystem is later remounted.
R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS
The m\bmo\bou\bun\bnt\bt() returns the value 0 if the mount was successful, otherwise -1
is returned and the variable _\be_\br_\br_\bn_\bo is set to indicate the error.
U\bUm\bmo\bou\bun\bnt\bt returns the value 0 if the umount succeeded; otherwise -1 is re-
turned and the variable _\be_\br_\br_\bn_\bo is set to indicate the error.
E\bER\bRR\bRO\bOR\bRS\bS
M\bMo\bou\bun\bnt\bt() will fail when one of the following occurs:
[EPERM] The caller is not the super-user.
[ENAMETOOLONG]
A component of a pathname exceeded 255 characters, or the en-
tire length of a path name exceeded 1023 characters.
[ELOOP] Too many symbolic links were encountered in translating a
pathname.
[ENOENT] A component of _\bd_\bi_\br does not exist.
[ENOTDIR] A component of _\bn_\ba_\bm_\be is not a directory, or a path prefix of
_\bs_\bp_\be_\bc_\bi_\ba_\bl is not a directory.
[EINVAL] A pathname contains a character with the high-order bit set.
[EBUSY] Another process currently holds a reference to _\bd_\bi_\br.
[EFAULT] _\bD_\bi_\br points outside the process's allocated address space.
The following errors can occur for a _\bu_\bf_\bs filesystem mount:
[ENODEV] A component of ufs_args _\bf_\bs_\bp_\be_\bc does not exist.
[ENOTBLK] _\bF_\bs_\bp_\be_\bc is not a block device.
[ENXIO] The major device number of _\bf_\bs_\bp_\be_\bc is out of range (this indi-
cates no device driver exists for the associated hardware).
[EBUSY] _\bF_\bs_\bp_\be_\bc is already mounted.
[EMFILE] No space remains in the mount table.
[EINVAL] The super block for the filesystem had a bad magic number or
an out of range block size.
[ENOMEM] Not enough memory was available to read the cylinder group in-
formation for the filesystem.
[EIO] An I/O error occurred while reading the super block or cylin-
der group information.
[EFAULT] _\bF_\bs_\bp_\be_\bc points outside the process's allocated address space.
The following errors can occur for a _\bn_\bf_\bs filesystem mount:
[ETIMEDOUT]
_\bN_\bf_\bs timed out trying to contact the server.
[EFAULT] Some part of the information described by nfs_args points out-
side the process's allocated address space.
The following errors can occur for a _\bm_\bf_\bs filesystem mount:
[EMFILE] No space remains in the mount table.
[EINVAL] The super block for the filesystem had a bad magic number or
an out of range block size.
[ENOMEM] Not enough memory was available to read the cylinder group in-
formation for the filesystem.
[EIO] An paging error occurred while reading the super block or
cylinder group information.
[EFAULT] _\bN_\ba_\bm_\be points outside the process's allocated address space.
U\bUm\bmo\bou\bun\bnt\bt may fail with one of the following errors:
[EPERM] The caller is not the super-user.
[ENOTDIR] A component of the path is not a directory.
[EINVAL] The pathname contains a character with the high-order bit set.
[ENAMETOOLONG]
A component of a pathname exceeded 255 characters, or an en-
tire path name exceeded 1023 characters.
[ELOOP] Too many symbolic links were encountered in translating the
pathname.
[EINVAL] The requested directory is not in the mount table.
[EBUSY] A process is holding a reference to a file located on the
filesystem.
[EIO] An I/O error occurred while writing cached filesystem informa-
tion.
[EFAULT] _\bD_\bi_\br points outside the process's allocated address space.
A _\bu_\bf_\bs or _\bm_\bf_\bs mount can also fail if the maximum number of filesystems are
currently mounted.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
mount(8), umount(8), mfs(8)
B\bBU\bUG\bGS\bS
Some of the error codes need translation to more obvious messages.
H\bHI\bIS\bST\bTO\bOR\bRY\bY
M\bMo\bou\bun\bnt\bt() and u\bum\bmo\bou\bun\bnt\bt() function calls appeared in Version 6 AT&T UNIX.
4th Berkeley Distribution July 11, 1993 4