mount
Overview
mount attaches a filesystem (block device, network share, bind path, tmpfs, …) onto a directory in the single Linux directory tree. Persistent mounts belong in /etc/fstab or systemd .mount units; interactive mount is for live operations and troubleshooting.
Syntax
mount [-t type] [-o options] device dir
mount # list mounts
mount -a # all fstab entries due at boot
mount -o remount,opts dirCommon Options
| Option | Description |
|---|---|
-t type |
Filesystem type (ext4, xfs, nfs4, cifs, tmpfs, overlay, …) |
-o opts |
Mount options (ro, noexec, nosuid, nodev, defaults, …) |
-a |
Mount all appropriate fstab entries |
-r / -w |
Read-only / read-write |
--bind / --rbind |
Bind mount (recursive) |
-v |
Verbose |
--source / --target |
Explicit long options |
Key Use Cases
- Attach disks and USB volumes
- Mount NFS/CIFS shares
- Bind mounts for chroots, containers, and rebuilds
- Temporary tmpfs workspaces
- Remount root or data with new options
Safety
- Wrong device → wrong data exposure. Verify with
lsblk -fandblkidbefore mounting.
- Prefer
UUID=/LABEL=in fstab over volatile/dev/sdXnames.
- Network mounts can hang the shell on outage — consider
soft/timeooptions and separate automount units.
- Unmount cleanly (
umount) before yanking USB or unplugging SAN LUNs.
Examples with Explanations
Inventory
findmnt
findmnt -t ext4,xfs
mount | column -t
findmnt -J | jq . # if jq installedPrefer findmnt for tree and JSON views.
Mount a partition by UUID
lsblk -f
sudo mkdir -p /mnt/data
sudo mount UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/data
df -h /mnt/dataRead-only mount (forensics / recovery)
sudo mount -o ro /dev/sdb1 /mnt/dataNFS
sudo mount -t nfs4 -o rw,hard,timeo=600 server.example:/export/path /mnt/nfsOptions trade durability vs hang behavior — know your storage SLA.
CIFS / SMB
sudo mount -t cifs //server/share /mnt/share \
-o credentials=/root/.smbcred,uid=1000,gid=1000,iocharset=utf8Keep credentials files mode 600.
Bind mounts
sudo mount --bind /var/www /mnt/www-view
sudo mount --rbind /home /mnt/chroot/homeBind mounts share the same filesystem; rbind includes submounts.
tmpfs
sudo mount -t tmpfs -o size=1G,mode=0755 tmpfs /mnt/scratchRAM-backed; contents vanish on unmount/reboot.
Remount
sudo mount -o remount,ro /
sudo mount -o remount,rw /Common in recovery environments.
fstab-driven
# /etc/fstab example:
# UUID=… /mnt/data ext4 defaults,nofail 0 2
sudo mount -a
sudo mount /mnt/data
findmnt /mnt/datanofail avoids boot hangs if the disk is absent (laptops/USB).
Overlay (container-style)
sudo mount -t overlay overlay -o lowerdir=/base,upperdir=/upper,workdir=/work /mergedUsed heavily by container engines; easy to get wrong — read overlay docs before production use.
Understanding Output
With no arguments, mount lists source, target, type, and options. Exit status non-zero means the mount failed (busy target, bad superblock, missing helper binary for NFS/CIFS, permission denied).
Notes & Pitfalls
- Helpers live as
mount.nfs,mount.cifs— missing packages cause cryptic errors.
- “Target is busy” on umount →
lsof +f -- /mnt/data,fuser -vm /mnt/data.
- Systemd may own the mount:
systemctl status mnt-data.mount.
user/usersfstab options allow non-root mount/umount with restrictions.
- Mount namespaces (containers) mean
findmntinside a pod is not the host’s view.
Additional Resources
man mount
man fstab
man systemd.mount