Home Blog Certs Knowledge Base About

mount / umount / fstab

Linux filesystem mounting: mount/umount commands, /etc/fstab persistent mounts, bind mounts, loop devices, and common mount options.

mount & umount

Basic mount commands
CommandDescription
mountList all currently mounted filesystems
mount -t ext4 /dev/sdb1 /mnt/dataMount with explicit type
mount /dev/sdb1 /mnt/dataMount (type auto-detected from superblock)
mount UUID=abc123 /mnt/dataMount by UUID
mount LABEL=data /mnt/dataMount by filesystem label
mount -o ro /dev/sdb1 /mnt/dataMount read-only
mount -o remount,rw /mnt/dataRemount without unmounting (change options)
mount -aMount all fstab entries not yet mounted
umount /mnt/dataUnmount by mount point
umount /dev/sdb1Unmount by device
umount -l /mnt/dataLazy unmount (detach immediately, wait for last process)
umount -f /mnt/nfsForce unmount (NFS gone stale)
Special mounts
CommandDescription
mount -o loop image.iso /mnt/isoMount an ISO image as a filesystem
mount --bind /src /dstBind mount โ€” expose a directory at another path
mount --rbind /src /dstRecursive bind (includes sub-mounts)
mount --make-private /mntPrevent mount propagation (namespaces)
mount -t tmpfs -o size=512m tmpfs /mnt/ramIn-memory tmpfs mount
mount -t nfs 10.0.0.1:/exports /mnt/nfsNFS mount
Inspect mounts
CommandDescription
findmntTree view of all active mounts
findmnt -t ext4Filter by filesystem type
findmnt /mnt/dataInfo about a specific mount point
findmnt --verifyVerify all fstab entries
cat /proc/mountsKernel view of current mounts
lsof +D /mnt/dataFind what process is keeping a mount busy
fuser -mv /mnt/dataShow all processes using the mount point
blkidUUIDs and filesystem types of block devices

/etc/fstab

fstab fields
FieldExampleDescription
deviceUUID=abc-123 or /dev/sdb1Source โ€” UUID is preferred (stable across reboots)
mount point/mnt/dataTarget directory
typeext4 / xfs / btrfs / nfs / autoFilesystem type
optionsdefaults,noatime,nofailComma-separated mount options
dump0 or 1Include in dump backup โ€” almost always 0
pass0, 1, 2fsck order: 0 = skip, 1 = root, 2 = all others
Mount options
OptionDescription
defaultsrw, suid, dev, exec, auto, nouser, async
noatimeDon't update access time on reads (major I/O reduction)
relatimeUpdate atime only if older than mtime (kernel default)
noexecDisallow executing binaries on this filesystem
nosuidIgnore SUID/SGID bits
nodevIgnore device files
nofailDon't fail boot if device is missing
roMount read-only
rwMount read-write (default)
userAllow regular user to mount (implies noexec,nosuid,nodev)
usersAny user can mount AND unmount
discardEnable TRIM for SSDs
compress=zstdBtrfs transparent compression
_netdevWait for network before mounting (NFS, CIFS)
x-systemd.automountAutomount 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.