Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

mount - mount file system (extension)

&pagelevel(4)&pagelevel

Description

mount() mounts a removable file system, which is contained in the block-special file identified by spec, in an existing directory dir (mount point).

spec and dir are pointers to pathnames.

mflag can assume the following values: 

 

MS_FSS

to describe a file system type.

 

MS_DATA

to describe a block of file-system specific data of length datalen starting at the address dataptr.

 

MS_RDONLY

if the file system is to be mounted as read-only, in which case, no further arguments are expected.

 

The argument fstyp is interpreted by mount() when either MS_FSS or MS_DATA is set in mflag. fstyp is the file system type number or a pointer to a string containing the file system type. The system call sysfs() can be used to determine the file system type number.

If neither MS_FSS nor MS_DATA are set in mflag, mount() defaults to the root file system type.

If MS_DATA is set in mflag, the system expects the dataptr and datalen arguments. This data is interpreted by file-system specific code within the operating system. Its format depends on the file system type. If a particular file system type does not require this data, dataptr and datalen should both be zero.

Upon successful completion of mount(), the name in dir refers to the root directory on the newly mounted file system.

Return val.

0

upon successful completion.


-1

if an error occurs. errno is set to indicate the error.

Errors

mount() will fail if: 

 

EBUSY

dir is already mounted at the time of the call, or
dir has some other owner, or
dir is otherwise busy, or
the special file associated with spec is currently mounted, or
no more mount table entries are available.

 

EFAULT

spec, dir or datalen points outside the allocated address space of the process.

 

EINVAL

The super-block has an invalid magic number or fstyp is invalid.

 

ELOOP

Too many symbolic links were encountered in resolving dir.

 

ENAMETOOLONG 



The length of the dir argument exceeds PATH_MAX or NAME_MAX.

 

ENOENT

One of the named files is not recognized.

 

ENOSPC

The file system state in the super-block is not FsOKAY and mflag requests write permission.

 

ENOTBLK

spec is not a block-special file.

 

ENOTDIR

A component of spec or dir is not a directory.

 

ENXIO

The special file associated with spec is not recognized.

 

EPERM

The effective user ID is not that of a process with appropriate privileges.

 

EREMOTE

spec is not local and cannot be mounted.

 

EROFS

spec is write-protected, and mflag requests write permission.

Notes

mount() may only be called under the effective user ID of a process with appropriate privileges.

As soon as a directory is mounted, it is treated as a subtree. In other words, files on the mounted file system can be accessed by processes without making allowances for the fact a mounted file system is involved. Links across file system boundaries with link() are not permitted, however, since that function checks the file system of a file.

The interface is intended only for the mount command. 

See also

sysfs(), umount(), the commands mount and fsck in the manual "POSIX Commands" [2 (Related publications)].