mount announces to the system that a removable
filesystem or resource is present on the special device.
(Filesystems other than root (/) are
considered removable in the sense that they can
be either available to users or unavailable.)
A block special device or a
remote resource can be mounted at the point
directory in an existing filesystem.
directory becomes the name of the
root of the newly mounted filesystem or resource.
directory must already exist and should be empty.
If directory
contains files, they will appear to have been removed after the
mount; they will reappear after an unmount using umount.
A unique resource can be mounted only once (multiple mounts are
not allowed).
mount and umount use a table
of mounted devices /etc/mnttab to add, query, and remove
entries.
mount invoked without any arguments displays:
the directory mount point
the name of each mounted device
if the filesystem is read-only or readable and writable
any non-default mount options for the filesystem
(noexec, nosuid, or trunc)
the date it was mounted
mount accepts the following options:
-ffstyp[,options]
indicates the type of filesystem (fstyp) to be mounted.
Filesystem types are listed in the
``Filesystem types''
section of this manual page.
If you omit this option, mount uses the type defined
for the filesystem in its /etc/default/filesys entry (see
filesys(F)).
If the filesystem being mounted does not have an entry
in filesys, mount calls
statfs(S)
to read the filesystem type from its superblock.
You can specify filesystem-specific options
after the filesystem type instead of
using the -o option. The recommended
method is to use -o.
Separate the modifiers from each other and from
the filesystem type using commas ``,''; do not include
spaces (see ``Examples'').
-m
Instructs mount or umount to refrain from
examining or updating the mount table (/etc/mnttab).
This option is generally not recommended for casual use.
-l
With no other options or arguments,
only displays local (not network-mounted) filesystems.
-w
Mounts the filesystem for read/write access. Overrides
settings specified in the
/etc/default/filesys file.
-ooptions
specifies generic and filesystem-specific mount options.
The following generic options are available:
exec
allow all executable files to be executed
(default).
noexec
do not allow files to be executed.
remount
change the generic options on an already-mounted filesystem without
having to unmount it.
You can specify any other generic option with
remount. You must specify any non-default generic option
(noexec, ro, nosuid, or trunc)
explicitly if it is to take effect. Otherwise, the filesystem
reverts to the corresponding default option instead.
Note that it is not possible to change
a filesystem from a read/write state (rw)
to a read-only state (ro).
rw
mount for reading and writing (default).
ro
mount for read-only. This is equivalent to specifying the
-r option.
suid
obey setuid and setgid bits
when executing a file
using the
exec(S)
system call
(default).
nosuid
ignore setuid and setgid bits
when executing a file
using the
exec
system call.
The suid and nosuid options only apply
to Rock Ridge (CD-ROM) and NFS filesystems.
maxvdepth=n
the maximum number of previous versions, n, which will be
maintained for versioned files in a filesystem. n must be a
positive integer. A value of 0 disables versioning. A value of ``unlimited''
enables the maximum number of versions possible for the filesystem.
Setting this value to 1 or higher effectively enables versioning for the
filesystem. If this value is not set, default values are specified
in the kernel tunable parameter MAXVDEPTH. This is supported
only on HTFS and DTFS filesystem types.
minvtime=n
the minimum time (in seconds) that a file must exist before
it can be versioned. If n is 0, there is no minimum time.
If this value is not set, default values are specified in the kernel tunable
parameter MINVTIME.This is supported
only on HTFS and DTFS filesystem types.
trunc
truncate long filenames silently. This disables the
path variable _POSIX_NO_TRUNC (see the description in
getconf(C)).
Do not use this option if you require
FIPS or XPG4-conformance.
notrunc
display the error message Filename too long
if a program attempts to access filenames which are longer than
the filesystem allows (default).
Any system call which attempts to access
or create filenames that are too long will fail and set
ENAMETOOLONG in
errno(S).
This usually causes the program to display the
above error message and exit.
Multiple options are specified as a comma-separated
list. When options conflict, the last option takes precedence.
An option only has an effect if it is valid for the filesystem type.
For example, a DOS filesystem understands options such
as ro, remount, and exec but it does
not understand options such as trunc and suid.
See the description of the -f option for
the descriptions of valid filesystem-specific option modifiers that
can be used with -o.
-r
indicates that a special device or resource is to
be mounted for read-only.
Physically write-protected filesystems, such as floppy
disks with write-protect tabs, and read-only advertised
filesystems must be mounted in this way. Otherwise
errors occur when access times are updated,
whether or not any explicit write is attempted.
The -o ro option is equivalent to -r.
-v
displays mount information verbosely.
Filesystem types
Filesystem types that can be mounted are:
AFS
Acer Fast Filesystems.
The following option modifiers are valid with AFS,
S51K, EAFS and HTFS filesystems:
nochkpt
Mount the filesystem with checkpointing disabled. Checkpointing
can speed reboot time after an unexpected system error by reducing
the chances that the filesystem will need to be checked with
fsck(ADM).
Disabling checkpointing can improve overall system performance.
nolog
Mount the filesystem with logging disabled. Logging is used to reduce
the amount of time needed to check a filesystem if a system crash occurs.
The logging mechanism keeps track of all modified data; this way, only
affected areas of the disk need to be checked. The S51K
filesystem does not support transaction logging.
tmp
Mount the filesystem as a temporary filesystem. Temporary filesystems
are updated less frequently, and are recommended for use on filesystems
containing temporary data only. If used on /tmp, the overall
system performance may be improved. If this option is specified, then
checkpointing will be disabled automatically.
DOS
DOS filesystems.
The following option modifier is available:
lower
Display filenames in lowercase. The default is to use uppercase.
DTFS
Desktop Filesystems.
The following option modifiers are available:
nocomp
Do not compress data written into this filesystem.
sync
Force data to be written synchronously to disk whenever a file is closed.
EAFS
Extended Acer Fast Filesystems.
The nochkpt, nolog and tmp option modifiers,
described for the AFS filesystem type, are also valid for
EAFS filesystems.
HS
High Sierra filesystems.
With the exception of uid, gid, and
dev, each option modifier should be specified no
more than once (later invocations of a modifier will override
earlier ones). If more than one mapping is specified for a file
or a value, the first instance is used.
The following option modifiers are valid with High Sierra
and ISO 9660 filesystems:
hide
Do not show hidden files.
lower
Display filenames in lowercase and suppress trailing
``.''s. The default is to use the filename as recorded on
the CD-ROM. If filenames have been recorded
as POSIX -style, this modifier is ineffective.
version
Display file version numbers. The default is not to display these.
If filenames have been recorded as POSIX-style, this
modifier is ineffective.
session=n
On multisession discs, the most recent session is mounted by default.
At this time the driver only supports mounting the first and last
sessions. You can access the last (most recent) session explicitly,
or by using the value of 0. For example, on a disc with five sessions,
a value of 1 indicates the first session, while 0 or 5 apply to the last
session.
sector=n
Allows the starting sector to be specified (which can be useful when
the start and end sectors are known, or when
attempting to mount a disc that has been written in a non-standard way).
In addition, the following option modifier is valid for
High Sierra filesystems:
relax
Apply the checks that were previously applied in the SCO Open Desktop Development System.
Use this option to mount CD-ROMs that are not
completely conformant to ISO 9660.
In the following option modifiers,
the term XAR (extended attribute record) refers to the
optional data structure used within an ISO 9660 format
CD-ROM for recording file attributes:
defuid=UID|user
defgid=GID|group
defuid defines the user ID for files
and directories recorded without a final unrestricted
XAR (default is the user ID of the
mount point).
defgid is similar to defuid, but sets the default
group ID.
If specified, user (group)
must be a valid user (group) name; UID (GID)
must be a valid user (group) ID in the range 0 to 60000.
filemode=mode
dirmode=mode
filemode sets the permissions for files recorded
without a final unrestricted XAR.
dirmode sets the permissions for directories recorded
without a final unrestricted XAR.
mode is an octal value produced by ORing the
following values (default is 0555):
Value
Permission set
0400
read by owner
0100
execute by owner
0040
read by group
0010
execute by group
0004
read by others
0001
execute by others
search
Grant search permissions for owner, group, and others on all
directories recorded with an
XAR regardless of the permissions recorded in it.
Directories without an XAR are controlled by the
dirmode option.
HTFS
High Throughput Filesystems.
The nochkpt, nolog and tmp option modifiers,
described for the AFS filesystem type, are also valid
with HTFS filesystems.
ISO9660
ISO 9660 CD-ROM filesystems.
With the exception of relax,
the option modifiers described for the HS filesystem
are also valid with ISO 9660 filesystems.
NFS
Networked Filesystems.
Specify the remote resource
in the form hostname:pathname.
The following option modifiers are available:
soft
Return error if the server does not respond.
bg
Background this mount. (This is recommended for
automatic mounts done during system startup.)
rsize=n
Set the read buffer size to n bytes.
The default size is 8192 bytes.
wsize=n
Set the write buffer size to n bytes.
The default size is 8192 bytes.
timeo=n
Set the initial NFS timeout to n
tenths of a second. The default is 300 tenths of a second.
retrans=n
Set the number of NFS retransmissions to
n.
The default is 5.
port=n
Set the server IP port number to n.
noac
Do not cache attributes. This is required when close
synchronization with the server is required.
Note that using this option will drastically impair
performance on the filesystem being mounted.
intr
Allow keyboard interrupts on hard mounts. This
allows the user to kill a process that is hung while
waiting for a response on a hard-mounted filesystem.
tcp
Use TCP as the transport for this filesystem.
spongy
Set soft semantics
for stat, lookup, fsstat, readlink,
and readdir (NFS operations and hard semantics for all
other NFS operations on the filesystem).
You do not need to specify -f NFS
to mount an NFS filesystem.
You can specify any filesystem-specific
option modifiers using the -o option (only valid options
will be applied).
NUCAM
NetWare® Automounter filesystems.
The resource argument is ignored for NUCAM
filesystems but mount expects a dummy entry to be present.
A suitable placeholder is a repeated directory entry:
/etc/mount -f NUCAM /mount_point /mount_point
There are no NUCAM-specific mount options.
The only supported generic options are ro and
remount; you cannot mount the filesystem with the rw option.
NUCFS
Volumes on NetWare servers.
Specify the remote resource
in the form server:volume where
volume must not begin with a slash (/).
All the generic mount options are supported.
The following option modifiers are also available:
gid=GID|group
Specify the group name or ID that will be used to open
the NetWare volume to be mounted.
grpid
Create files with the GID set to the
GID of the parent directory (default).
nogrpid
Create files with the GID set to the effective
GID of the calling process.
uid=UID|user
Specify the user name or ID that will be used to open
the NetWare volume to be mounted.
The user calling mount (or the requested uid)
must be authenticated (via nwlogin) to ``NetWareServer''
for the mount to succeed.
RCKRDG
Rock Ridge CD-ROM filesystems.
The hide, lower and version option
modifiers described for the HS filesystem type also
apply to Rock Ridge filesystems.
In addition, the following option modifiers are only valid on
Rock Ridge filesystems:
dev=cd_path:devnum
Define devnum to be the device number for the device
file specified by the pathname on the
CD-ROM filesystem. cd_path must be a fully
qualified pathname from the root of the CD-ROM.
devnum must be a valid device number in the range 0 to
65535.
devmap=pathname
devmap can be used where there would otherwise be several
dev mappings on the command line. The file specified by
pathname contains lines of the form:
cd_path:devnum [comment]
uid="cd_uid:UID|user"
gid="cd_gid:GID|group"
uid maps the user ID cd_gid
recorded on the CD-ROM to a system user ID.
gid is similar to uid but maps a group
ID.
If specified, user (group)
must be a valid user (group) name; UID (GID)
must be a valid user (group) ID in the range 0 to 60000.
uidmap=pathname
gidmap=pathname
uidmap can be used where there would otherwise be several
uid mappings on the command line. The file specified by
pathname contains lines of the form:
cd_uid:UID|user [comment]
where each line defines a user ID mapping.
gidmap is similar to uidmap but the mapping
file has the format:
cd_gid:GID|group [comment]
where each line defines a group ID mapping.
write
Make device files and named pipes writable. (Filesystems mounted
with this option modifier are not XPG3 compliant.
However, if this option modifier is not given, opening a file on
a read-only filesystem will give rise to an EROFS
error.)
S51K
AT&T UNIX System V® 1KB filesystems.
The nochkpt and tmp option modifiers
described for the AFS filesystem type are also valid
with S51K filesystems.
XENIX
XENIX[®] 286/386 filesystems.
umount usage
umount announces to the system that the previous
mounted special device or resource is to be
removed. Alternatively, the mount point directory can be
specified; umount searches the filesystem table
/etc/default/filesys to find the corresponding special
file.
Any pending I/O for the filesystem is
completed and the file structure is marked as clean.
Busy filesystems cannot be dismounted with umount.
A filesystem is busy if it contains an open file or an active user's
working directory.
Filesystem-dependent binaries
The directories /etc/fscmd.d/fstyp contain variations of
programs (such as
fsck)
that depend on the filesystem type; mount and umount
invoke the appropriate binary.
Exit values
mount returns the following values:
0
Success.
1
Failed to open mount table.
2
Failed (any other reason).
Diagnostics
mount prints an appropriate diagnostic if the mount
fails. A warning is issued if the filesystem to be mounted is
already mounted at a different mount point.
Invalid option modifiers produce the following message
for a filesystem type fstyp:
mount: invalidfstypoption: invalid_string
A warning is issued if the kernel has not been configured to support
the filesystem type to be mounted. Use
mkdev(ADM)
to configure the kernel to support DOS, HS,
and XENIX filesystems.
umount fails if a special device or
resource is not mounted or is busy, with the message:
device busy
which indicates that an executing program is using a file on the
filesystem to be unmounted.
This is often caused by invoking umount while your current working
directory is in the filesystem, or by someone else working in the filesystem.
Examples
This example mounts the CD-ROM device
/dev/cd0 on /mnt, converts filenames
to lowercase, outputs file version numbers,
makes device files and named pipes
writable, maps device numbers as defined in
mapfile, and sets the
default user ID to root:
mount -f HS,lower,write,devmap=./mapfile,defuid=root /dev/cd0 /mnt
Using the -o option, this is written as:
mount -f HS -o lower,write,devmap=./mapfile,defuid=root /dev/cd0 /mnt
The following commands are equivalent:
mount -o ro,nosuid,trunc foobar:/remotefs /mnt
mount -f NFS,ro,nosuid,trunc foobar:/remotefs /mnt
mount -f NFS,ro -o nosuid,trunc foobar:/remotefs /mnt
mount -f NFS -o ro,nosuid,trunc foobar:/remotefs /mnt
Warning
Always umount filesystems on floppy disks before removing
them from the floppy drive. Failure to do so will require
fsck
to be run when the disk is next mounted.
Use of the option modifier noac with
NFS-mounted filesystems will drastically impair
performance on the filesystem being mounted.
Limitations
The mount special device must be a block special file;
however, it can be a block special file that has been associated with
a regular file by using
marry(ADM).
You must have installed NFS to be able to mount a
remote filesystem.
Note that when the system is in single-user mode, the commands that look in
/etc/mnttab for default arguments (for example
bcheckrc(ADM),
df(C),
ncheck(ADM),
quot(ADM),
mount, and umount) give either incorrect results
(due to a corrupt
mnttab(F)
left over from a non-shutdown stoppage) or no results (due to an empty
/etc/mnttab from a shutdown stoppage).
When in multiuser mode, this is not a problem;
the /etc/bcheckrc script initializes /etc/mnttab to contain
only /dev/root, and subsequent mounts update it appropriately.
The mount and umount
commands use a lock file to guarantee exclusive access to /etc/mnttab.
The other commands which read /etc/mnttab do not
check the lock file; they may return incorrect values if they are
used while a filesystem is being mounted or unmounted.
This is not a problem in practice since mount and
umount are not frequent operations.
Note that /etc/mnttab is a regular file which can be
modified. Because
of this, the contents can be inconsistent with the real state of the
system. For example, if the file is absent, mount will report that
no filesystems are mounted.
Authorization
Only root or a user authorized by
asroot(ADM)
can use the mount and umount commands to
mount or unmount filesystems.
Anyone can use mount to list mounted filesystems and
resources.