mount · Linux command

Also known as: mount command

On this page 7

mount is the Linux command that attaches a filesystem to a directory, called the mount point, so that its files become part of the single directory tree rooted at /. In the Linux filesystem model there are no drive letters: every disk partition, network share, disk image or virtual filesystem becomes reachable only after it has been mounted somewhere in the hierarchy.

The mount command, provided on most distributions by the util-linux package, is a user-space front end to the kernel’s mount() system call. Run without arguments, it lists the filesystems that are currently attached; run with a device and a directory, it asks the kernel to connect a filesystem driver to that location with a chosen set of options.

How the mount command attaches a filesystem

When a user runs mount /dev/sdb1 /mnt/data, the command identifies the filesystem type, either from the -t option or by probing the device signature through libblkid, and then calls the kernel. The kernel loads the matching filesystem driver, such as ext4, XFS or Btrfs, reads the superblock and creates a mount entry that links the root of the new filesystem to the target directory.

From that moment, any path below /mnt/data resolves into the mounted filesystem rather than into the directory that existed there before. The original contents of the mount point are hidden, not deleted, and they become visible again after the filesystem is detached with umount. The kernel records every active mount in its mount table, which is exposed through /proc/self/mountinfo and the more familiar /proc/mounts.

The common invocation forms are summarized in the following table.

InvocationEffectTypical use
mountLists all current mountsQuick inspection
mount /dev/sdb1 /mnt/dataMounts a device on a directoryAttaching a disk
mount -t nfs host:/export /mnt/nfsMounts a network shareShared storage
mount -o loop image.iso /mnt/isoMounts a file as a block deviceReading disk images
mount -aMounts everything in fstabBoot and testing
mount -o remount,ro /Changes options in placeMaintenance and recovery
Common forms of the mount command

Mounting ordinary block devices requires root privileges or the CAP_SYS_ADMIN capability. Unprivileged users can mount only entries marked with the user or users option in /etc/fstab, through FUSE-based tools, or inside user namespaces where the kernel permits it for selected filesystem types.

Mount options and what they control

Mount options passed with -o define how the kernel treats the filesystem, and they are a central tool for both performance tuning and security hardening. Some options are generic and apply to any filesystem, while others are filesystem-specific and are interpreted only by the driver in question.

OptionMeaningMain consideration
ro / rwRead-only or read-write accessRead-only protects data during recovery
noexecBlocks execution of binariesHardens /tmp and removable media
nosuidIgnores setuid and setgid bitsPrevents privilege escalation
nodevIgnores device filesStandard on user-writable mounts
noatime / relatimeLimits access-time updatesReduces write load
defaultsrw, suid, dev, exec, auto, nouser, asyncBaseline for fstab entries
uid= / gid=Sets file ownershipNeeded for FAT and exFAT
Frequently used mount options

Since kernel 2.6.30, relatime is the default access-time behavior on most systems, updating access times only when they are older than the modification time or more than a day old. Choosing noatime saves additional writes, but it can break the rare tools that rely on access times, such as some mail clients that detect new messages this way.

The mount command is the manual, immediate interface to the kernel’s mount mechanism, while several other components automate or complement it. Understanding their division of labor prevents configuration errors that appear only after a reboot.

Tool or fileRoleRelationship to mount
/etc/fstabDeclares persistent mountsRead by mount -a and at boot
systemd mount unitsManage mounts as servicesGenerated from fstab or written directly
umountDetaches a filesystemReverse operation
findmntDisplays the mount treeClearer output than plain mount
lsblk / blkidIdentify devices and UUIDsSupply arguments for mount
FUSE toolsMount user-space filesystemsUse the same kernel tree
The mount command compared with related tools

On distributions that use systemd, the systemd-fstab-generator converts each fstab line into a mount unit at boot, which allows dependencies, timeouts and automounting. A bind mount, created with mount --bind, attaches an existing directory at a second location and is heavily used by container runtimes, while OverlayFS stacks several directories into one merged view.

Using mount safely in practice

Reliable use of the mount command depends on identifying devices correctly and testing persistent configuration before rebooting. Device names such as /dev/sdb can change between boots when hardware is added or detected in a different order, so persistent configuration should reference a filesystem UUID or label, obtained with blkid or lsblk -f.

SituationRecommended practiceReason
Adding a permanent data diskUse UUID= in fstab, then run mount -aStable naming and early error detection
Optional external driveAdd nofail to the fstab entryBoot continues if the drive is absent
Investigating a damaged diskMount read-only with -o roAvoids further writes
Mount point reports busyFind users with lsof or fuser -mExplains why umount fails
Network share at bootAdd _netdev or use automountWaits for networking
Typical situations and recommended practice

Before editing /etc/fstab, a careful administrator keeps a root shell open and runs `mount -a` or `findmnt –verify` immediately after the change. A single typo in a required entry can drop the system into emergency mode at the next boot, which is far harder to fix on a remote server without console access.

Common errors and misconceptions

Several recurring mistakes stem from misunderstanding what mounting does to the directory tree. The list below covers the problems that experienced Linux administrators encounter most often.

  • Writing data before the disk is mounted: files saved into an unmounted mount point land on the root filesystem and seem to disappear once the disk is attached.
  • Wrong filesystem type: messages such as “wrong fs type, bad option, bad superblock” often mean a missing driver or helper such as mount.nfs.
  • Assuming remount changes everything: some options cannot be changed with remount and require a full unmount.
  • Forcing a busy unmount: umount -l performs a lazy unmount that hides the problem rather than releasing open files.
  • Treating mount output as authoritative in containers: each mount namespace has its own table, so the host and a container see different trees.

A plain-language summary

A Linux computer keeps all of its files in one big folder tree. When a new disk, USB stick or network folder is connected, it does not appear by itself. The mount command connects that storage to a chosen folder, and from then on its files show up there.

It is like plugging a hallway into an existing house: the new rooms only become reachable once the door is attached. The key point is that nothing is usable until it is mounted, and it should be unmounted before unplugging to keep data safe.

An example from practice

A systems administrator adds a 4 TB disk to a file server to hold nightly backups. After creating an ext4 filesystem on /dev/sdc1, the administrator runs blkid to read its UUID, creates the directory /srv/backup and tests the setup with mount /dev/sdc1 /srv/backup. The df -h output confirms the new capacity is available at the expected path.

To make the mount permanent, the administrator adds an fstab line using UUID=, the options defaults,noatime,nofail and filesystem check order 2. After unmounting the disk, running mount -a reattaches it without errors, which proves the entry is valid before any reboot. When the server later restarts during maintenance, the backup volume comes up automatically, and the nofail option ensures that a failed disk would not block the boot process.