Search notes:

Shell command: mount

Standard form

mount [-t fs-type] [device] dir
-t fs-type is optional because mount is usually able to detect the filesystem type.
If device is also omitted, mount tries to determine the device to be mounted from /etc/fstab.

Show all mounted file systems

Without options, mount shows all mounted filesystems:
mount
It can be combined with -t to show all filesystems of a given type:
mount -t ext4
mount -t 9p

Command line options

-a --all Mount all filesystems 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. Can be combined with -t
-B --bind Remount a subtree somewhere else (so that its contents are available in both places).
-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.
-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.
-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.
-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.
-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.
--options-mode mode Controls how to combine options from fstab or 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).
-r --read-only Mount the filesystem read-only. A synonym is -o ro.
-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(8) 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. For supported filesystem types, get some inspiration from /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.
-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 syscall with read-write flags on write-protected devices of filesystems 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.

Mount options

Filesystem independent options

async All I/O to the filesystem should be done asynchronously. (See also the sync option.)
atime Do not use the noatime feature, so the inode access time is controlled by kernel defaults. See also the descriptions of the relatime and strictatime mount options.
noatime Do not update inode access times on this filesystem (e.g. for faster access on the news spool to speed up news servers). This works for all inode types (directories too), so it implies nodiratime.
auto Can be mounted with the -a option.
noauto Can only be mounted explicitly (i.e., the -a option will not cause the filesystem to be mounted).
context
defaults Use the default options: rw, suid, dev, exec, auto, nouser, and async.
dev Interpret character or block special devices on the filesystem.
nodev Do not interpret character or block special devices on the filesystem.
diratime Update directory inode access times on this filesystem. This is the default. (This option is ignored when noatime is set.)
nodiratime Do not update directory inode access times on this filesystem. (This option is implied when noatime is set.)
dirsync All directory updates within the filesystem should be done synchronously. This affects the following system calls: creat, link, unlink, symlink, mkdir, rmdir, mknod and rename.
exec Permit execution of binaries.
noexec Do not permit direct execution of any binaries on the mounted filesystem.
group Allow an ordinary user to mount the filesystem if one of that user's groups matches the group of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line group,dev,suid).
iversion Every time the inode is modified, the i_version field will be incremented.
noiversion Do not increment the i_version inode field.
mand Allow mandatory locks on this filesystem. See fcntl(2).
nomand Do not allow mandatory locks on this filesystem.
_netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
nofail Do not report errors for this device if it does not exist.
relatime Update inode access times relative to modify or change time. Access time is only updated if the previous access time was earlier than the current modify or change time. (Similar to noatime, but it doesn't break mutt or other applications that need to know if a file has been read since the last time it was modified.)
norelatime Do not use the relatime feature. See also the strictatime mount option.
strictatime Allows to explicitly request full atime updates. This makes it possible for the kernel to default to relatime or noatime but still allow userspace to override it. For more details about the default system mount options see /proc/mounts.
nostrictatime Use the kernel's default behavior for inode access time updates.
lazytime Only update times (atime, mtime, ctime) on the in-memory version of the file inode.
nolazytime Do not use the lazytime feature.
suid Honor set-user-ID and set-group-ID bits or file capabilities when executing programs from this filesystem.
nosuid Do not honor set-user-ID and set-group-ID bits or file capabilities when executing programs from this filesystem.
silent Turn on the silent flag.
loud Turn off the silent flag.
owner Allow an ordinary user to mount the filesystem if that user is the owner of the device. This option implies the options nosuid and nodev (unless overridden by subsequent options, as in the option line owner,dev,suid).
remount Attempt to remount an already-mounted filesystem. This is commonly used to change the mount flags for a filesystem, especially to make a readonly filesystem writable. It does not change device or mount point.
ro / rw Mount the filesystem read-only/read-write
sync All I/O to the filesystem should be done synchronously. In the case of media with a limited number of write cycles (e.g. some flash drives), sync may cause life-cycle shortening.
user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to the mtab file (or to the private libmount file in /run/mount on systems without a regular mtab) so that this same user can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
nouser Forbid an ordinary user to mount the filesystem. This is the default; it does not imply any other options.
users Allow any user to mount and to unmount the filesystem, even when some other ordinary user mounted it. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).
X-* All options prefixed with "X-" are interpreted as comments or as userspace application-specific options. These options are not stored in user space (e.g., mtab file), nor sent to the mount.type helpers nor to the mount(2) system call. The suggested format is X-appname.option.
x-* The same as X-* options, but stored permanently in user space. This means the options are also available for umount or other operations. Note that maintaining mount options in user space is tricky, because it's necessary use libmount-based tools and there is no guarantee that the options will be always available (for example after a move mount operation or in unshared namespace).
X-mount.mkdir[=mode] Allow to make a target directory (mountpoint) if it does not exit yet. The optional argument mode specifies the filesystem access mode used for mkdir(2) in octal notation. The default mode is 0755. This functionality is supported only for root users or when mount executed without suid per‐ missions. The option is also supported as x-mount.mkdir, this notation is deprecated since v2.30.

Mounting ntfs, fvat etc devices

It seems that chmod has no effect on ntfs or fvat devices except when they are mounted with the umask option:
mount -o umask=000 /dev/sdb1 /media

Mounting as a specific user and group

The -o option can alse be used to mount as a specific user or group:
mount -o uid=rene,gid=admin /dev/sdb1 /mnt/E

Determining on what device a directory is mounted

df /media/rene/TOSHIBA/images might print
Filesystem      1K-blocks     Used  Available Use% Mounted on
/dev/sdb1      1953410044 98704032 1854706012   6% /media/rene/TOSHIBA

Left aligned output of mount

awk can be used to create a visually nicer (imho) output of mount. Note also the swapping of the first and second column ($3, $1):
$ mount | awk '{printf "%-26s %-12s %-11s %s\n", $3, $1, $5, $6}'
See also mnt: a shell script that only shows /dev devices and uses column to print them in tabular fashion, also with the goal to make the output more easy on the eye.

See also

umount
lsblk
/etc/mtab, /etc/fstab, /proc/mounts.
findmnt
Shell commands
The mount function pointer in the file_system_type struct.
The Windows console command mountvol.exe and the PowerShell command new-psDrive.

Index