The full set of mount options used by an invocation of mount
is
determined by first extracting the mount options for the
filesystem from the fstab table, then applying any options
specified by the -o
argument, and finally applying a -r
or -w
option, when present.
The mount
command does not pass all command-line options to the
/sbin/mount.
suffix mount helpers. The interface between mount
and
the mount helpers is described below in the section EXTERNAL
HELPERS
.
Command-line options available for the mount
command are:
-a
, --all
Mount all filesystems (of the given types) mentioned in fstab
(except for those whose line contains the noauto
keyword).
The filesystems are mounted following their order in fstab.
The mount
command compares filesystem source, target (and fs
root for bind mount or btrfs) to detect already mounted
filesystems. The kernel table with already mounted
filesystems is cached during mount --all
. This means that all
duplicated fstab entries will be mounted.
The option --all
is possible to use for remount operation
too. In this case all filters (-t
and -O
) are applied to the
table of already mounted filesystems.
Since version 2.35 is possible to use the command line option
-o
to alter mount options from fstab (see also
--options-mode
).
Note that it is a bad practice to use mount -a
for fstab
checking. The recommended solution is findmnt --verify
.
-B
, --bind
Remount a subtree somewhere else (so that its contents are
available in both places). See above, under Bind mounts
.
-c
, --no-canonicalize
Don't canonicalize paths. The mount
command canonicalizes all
paths (from the command line or fstab) by default. This
option can be used together with the -f
flag for already
canonicalized absolute paths. The option is designed for
mount helpers which call mount -i
. It is strongly recommended
to not use this command-line option for normal mount
operations.
Note that mount
does not pass this option to the
/sbin/mount.
type helpers.
-F
, --fork
(Used in conjunction with -a
.) Fork off a new incarnation of
mount
for each device. This will do the mounts on different
devices or different NFS servers in parallel. This has the
advantage that it is faster; also NFS timeouts proceed in
parallel. A disadvantage is that the order of the mount
operations is undefined. Thus, you cannot use this option if
you want to mount both /usr and /usr/spool.
-f, --fake
Causes everything to be done except for the actual system
call; if it's not obvious, this "fakes" mounting the
filesystem. This option is useful in conjunction with the -v
flag to determine what the mount
command is trying to do. It
can also be used to add entries for devices that were mounted
earlier with the -n
option. The -f
option checks for an
existing record in /etc/mtab and fails when the record
already exists (with a regular non-fake mount, this check is
done by the kernel).
-i, --internal-only
Don't call the /sbin/mount.
filesystem helper even if it
exists.
-L
, --label
label
Mount the partition that has the specified label.
-l
, --show-labels
Add the labels in the mount output. mount
must have
permission to read the disk device (e.g. be set-user-ID root)
for this to work. One can set such a label for ext2, ext3 or
ext4 using the e2label(8) utility, or for XFS using
xfs_admin(8), or for reiserfs using reiserfstune
(8).
-M
, --move
Move a subtree to some other place. See above, the subsection
The move operation
.
-m
, --mkdir
[=mode]
Allow to make a target directory (mountpoint) if it does not
exist yet. Alias to "-o X-mount.mkdir[=mode]", the default
mode is 0755. For more details see X-mount.mkdir
below.
-n
, --no-mtab
Mount without writing in /etc/mtab. This is necessary for
example when /etc is on a read-only filesystem.
-N
, --namespace
ns
Perform the mount operation in the mount namespace specified
by ns. ns is either PID of process running in that namespace
or special file representing that namespace.
mount
switches to the mount namespace when it reads
/etc/fstab, writes /etc/mtab: (or writes to _/run/mount) and
calls the mount(2) system call, otherwise it runs in the
original mount namespace. This means that the target
namespace does not have to contain any libraries or other
requirements necessary to execute the mount(2) call.
See mount_namespaces(7) for more information.
-O
, --test-opts
opts
Limit the set of filesystems to which the -a
option applies.
In this regard it is like the -t
option except that -O
is
useless without -a
. For example, the command
mount -a -O no_netdev
mounts all filesystems except those which have the option
netdev specified in the options field in the /etc/fstab file.
It is different from -t
in that each option is matched
exactly; a leading no
at the beginning of one option does not
negate the rest.
The -t
and -O
options are cumulative in effect; that is, the
command
mount -a -t ext2 -O _netdev
mounts all ext2 filesystems with the _netdev option, not all
filesystems that are either ext2 or have the _netdev option
specified.
-o
, --options
opts
Use the specified mount options. The opts argument is a
comma-separated list. For example:
mount LABEL=mydisk -o noatime,nodev,nosuid
For more details, see the FILESYSTEM-INDEPENDENT MOUNT
OPTIONS
and FILESYSTEM-SPECIFIC MOUNT OPTIONS
sections.
--options-mode
mode
Controls how to combine options from fstab/mtab with options
from the command line. mode can be one of ignore
, append
,
prepend
or replace
. For example, append
means that options
from fstab are appended to options from the command line. The
default value is prepend
— it means command line options are
evaluated after fstab options. Note that the last option wins
if there are conflicting ones.
--options-source
source
Source of default options. source is a comma-separated list
of fstab
, mtab
and disable
. disable
disables fstab
and mtab
and disables --options-source-force
. The default value is
fstab,mtab
.
--options-source-force
Use options from fstab/mtab even if both device and dir are
specified.
-R
, --rbind
Remount a subtree and all possible submounts somewhere else
(so that its contents are available in both places). See
above, the subsection Bind mounts
.
-r
, --read-only
Mount the filesystem read-only. A synonym is -o ro
.
Note that, depending on the filesystem type, state and kernel
behavior, the system may still write to the device. For
example, ext3 and ext4 will replay the journal if the
filesystem is dirty. To prevent this kind of write access,
you may want to mount an ext3 or ext4 filesystem with the
ro,noload
mount options or set the block device itself to
read-only mode, see the blockdev(8) command.
-s
Tolerate sloppy mount options rather than failing. This will
ignore mount options not supported by a filesystem type. Not
all filesystems support this option. Currently it's supported
by the mount.nfs
mount helper only.
--source
device
If only one argument for the mount
command is given, then the
argument might be interpreted as the target (mountpoint) or
source (device). This option allows you to explicitly define
that the argument is the mount source.
--target
directory
If only one argument for the mount command is given, then the
argument might be interpreted as the target (mountpoint) or
source (device). This option allows you to explicitly define
that the argument is the mount target.
--target-prefix
directory
Prepend the specified directory to all mount targets. This
option can be used to follow fstab, but mount operations are
done in another place, for example:
mount --all --target-prefix /chroot -o X-mount.mkdir
mounts all from system fstab to /chroot, all missing
mountpoint are created (due to X-mount.mkdir). See also
--fstab
to use an alternative fstab.
-T
, --fstab
path
Specifies an alternative fstab file. If path is a directory,
then the files in the directory are sorted by strverscmp(3);
files that start with "." or without an .fstab extension are
ignored. The option can be specified more than once. This
option is mostly designed for initramfs or chroot scripts
where additional configuration is specified beyond standard
system configuration.
Note that mount
does not pass the option --fstab
to the
/sbin/mount.
type helpers, meaning that the alternative fstab
files will be invisible for the helpers. This is no problem
for normal mounts, but user (non-root) mounts always require
fstab to verify the user's rights.
-t
, --types
fstype
The argument following the -t
is used to indicate the
filesystem type. The filesystem types which are currently
supported depend on the running kernel. See /proc/filesystems
and /lib/modules/$(uname -r)/kernel/fs for a complete list of
the filesystems. The most common are ext2, ext3, ext4, xfs,
btrfs, vfat, sysfs, proc, nfs and cifs.
The programs mount
and umount(8) support filesystem subtypes.
The subtype is defined by a '.subtype' suffix. For example
'fuse.sshfs'. It's recommended to use subtype notation rather
than add any prefix to the mount source (for example
'sshfs#example.com' is deprecated).
If no -t
option is given, or if the auto
type is specified,
mount
will try to guess the desired type. mount
uses the
libblkid(3) library for guessing the filesystem type; if that
does not turn up anything that looks familiar, mount
will try
to read the file /etc/filesystems, or, if that does not
exist, /proc/filesystems. All of the filesystem types listed
there will be tried, except for those that are labeled
"nodev" (e.g. devpts, proc and nfs). If /etc/filesystems ends
in a line with a single *, mount will read /proc/filesystems
afterwards. While trying, all filesystem types will be
mounted with the mount option silent
.
The auto
type may be useful for user-mounted floppies.
Creating a file /etc/filesystems can be useful to change the
probe order (e.g., to try vfat before msdos or ext3 before
ext2) or if you use a kernel module autoloader.
More than one type may be specified in a comma-separated
list, for the -t
option as well as in an /etc/fstab entry.
The list of filesystem types for the -t
option can be
prefixed with no
to specify the filesystem types on which no
action should be taken. The prefix no
has no effect when
specified in an /etc/fstab entry.
The prefix no
can be meaningful with the -a
option. For
example, the command
mount -a -t nomsdos,smbfs
mounts all filesystems except those of type msdos and smbfs.
For most types all the mount
program has to do is issue a
simple mount(2) system call, and no detailed knowledge of the
filesystem type is required. For a few types however (like
nfs, nfs4, cifs, smbfs, ncpfs) an ad hoc code is necessary.
The nfs, nfs4, cifs, smbfs, and ncpfs filesystems have a
separate mount program. In order to make it possible to treat
all types in a uniform way, mount
will execute the program
/sbin/mount.
type (if that exists) when called with type type.
Since different versions of the smbmount
program have
different calling conventions, /sbin/mount.smbfs
may have to
be a shell script that sets up the desired call.
-U
, --uuid
uuid
Mount the partition that has the specified uuid.
-v
, --verbose
Verbose mode.
-w
, --rw
, --read-write
Mount the filesystem read/write. Read-write is the kernel
default and the mount
default is to try read-only if the
previous mount(2) syscall with read-write flags on
write-protected devices failed.
A synonym is -o rw
.
Note that specifying -w
on the command line forces mount
to
never try read-only mount on write-protected devices or
already mounted read-only filesystems.
-V
, --version
Display version information and exit.
-h
, --help
Display help text and exit.