Linux filesystem mounting: mount/umount commands, /etc/fstab persistent mounts, bind mounts, loop devices, and common mount options.
mount & umount
Basic mount commands
| Command | Description |
|---|---|
| mount | List all currently mounted filesystems |
| mount -t ext4 /dev/sdb1 /mnt/data | Mount with explicit type |
| mount /dev/sdb1 /mnt/data | Mount (type auto-detected from superblock) |
| mount UUID=abc123 /mnt/data | Mount by UUID |
| mount LABEL=data /mnt/data | Mount by filesystem label |
| mount -o ro /dev/sdb1 /mnt/data | Mount read-only |
| mount -o remount,rw /mnt/data | Remount without unmounting (change options) |
| mount -a | Mount all fstab entries not yet mounted |
| umount /mnt/data | Unmount by mount point |
| umount /dev/sdb1 | Unmount by device |
| umount -l /mnt/data | Lazy unmount (detach immediately, wait for last process) |
| umount -f /mnt/nfs | Force unmount (NFS gone stale) |
Special mounts
| Command | Description |
|---|---|
| mount -o loop image.iso /mnt/iso | Mount an ISO image as a filesystem |
| mount --bind /src /dst | Bind mount โ expose a directory at another path |
| mount --rbind /src /dst | Recursive bind (includes sub-mounts) |
| mount --make-private /mnt | Prevent mount propagation (namespaces) |
| mount -t tmpfs -o size=512m tmpfs /mnt/ram | In-memory tmpfs mount |
| mount -t nfs 10.0.0.1:/exports /mnt/nfs | NFS mount |
Inspect mounts
| Command | Description |
|---|---|
| findmnt | Tree view of all active mounts |
| findmnt -t ext4 | Filter by filesystem type |
| findmnt /mnt/data | Info about a specific mount point |
| findmnt --verify | Verify all fstab entries |
| cat /proc/mounts | Kernel view of current mounts |
| lsof +D /mnt/data | Find what process is keeping a mount busy |
| fuser -mv /mnt/data | Show all processes using the mount point |
| blkid | UUIDs and filesystem types of block devices |
/etc/fstab
fstab fields
| Field | Example | Description |
|---|---|---|
| device | UUID=abc-123 or /dev/sdb1 | Source โ UUID is preferred (stable across reboots) |
| mount point | /mnt/data | Target directory |
| type | ext4 / xfs / btrfs / nfs / auto | Filesystem type |
| options | defaults,noatime,nofail | Comma-separated mount options |
| dump | 0 or 1 | Include in dump backup โ almost always 0 |
| pass | 0, 1, 2 | fsck order: 0 = skip, 1 = root, 2 = all others |
Mount options
| Option | Description |
|---|---|
| defaults | rw, suid, dev, exec, auto, nouser, async |
| noatime | Don't update access time on reads (major I/O reduction) |
| relatime | Update atime only if older than mtime (kernel default) |
| noexec | Disallow executing binaries on this filesystem |
| nosuid | Ignore SUID/SGID bits |
| nodev | Ignore device files |
| nofail | Don't fail boot if device is missing |
| ro | Mount read-only |
| rw | Mount read-write (default) |
| user | Allow regular user to mount (implies noexec,nosuid,nodev) |
| users | Any user can mount AND unmount |
| discard | Enable TRIM for SSDs |
| compress=zstd | Btrfs transparent compression |
| _netdev | Wait for network before mounting (NFS, CIFS) |
| x-systemd.automount | Automount via systemd on first access |
Example fstab entries:
# Standard data disk (UUID recommended over /dev/sdX)
UUID=1234-abcd /mnt/data ext4 defaults,noatime,nofail 0 2
# SSD with TRIM
UUID=5678-efgh /home ext4 defaults,noatime,discard 0 2
# XFS โ growfs works while mounted
UUID=9abc-1234 /var/data xfs defaults,noatime 0 2
# NFS share โ wait for network, don't block boot
10.0.0.1:/exports /mnt/nfs nfs defaults,_netdev,nofail 0 0
# tmpfs RAM disk
tmpfs /tmp tmpfs size=2g,mode=1777 0 0
# ISO bind mount
/data/image.iso /mnt/iso iso9660 loop,ro 0 0
After editing fstab: mount -a to apply changes and check for errors before rebooting.