Pcornel
Linux

Filesystems & Mounting

Cheat sheet · https://pcornel.dk/topic.php?topic=357

Back to the Topic

Answer

Filesystems organise data on block devices (ext4, XFS, Btrfs) or in memory (tmpfs); mounting attaches them to a directory. /etc/fstab and systemd mount units define permanent mounts.

Remember

Use UUIDs in fstab and test with findmnt --verify and mount -a before rebooting — a bad entry drops boot into emergency mode. nofail for non-critical mounts.

First checks

  • findmnt — mount tree with options
  • df -hT — usage and filesystem types
  • findmnt --verify — check /etc/fstab
  • dmesg -T | grep -iE 'ext4|xfs|btrfs' — filesystem kernel messages

Commands

mkfs
Create a new filesystem structure on a selected block device or logical volume.
mount
Attach a filesystem to the namespace or display currently mounted filesystems.
umount
Detach a mounted filesystem from the current mount namespace.
df
Report mounted-filesystem capacity, free space and inode usage from filesystem statistics.
du
Measure apparent or allocated space consumed by files and directory trees.
fsck
Check filesystem consistency and, when requested, repair filesystem metadata.
findmnt [TARGET]
Display mounted filesystems and sources.
lsblk -f
findmnt
df -hT
mount -a
mount -o remount,<options>
mount --bind olddir newdir
findmnt --verify
mount /dev/sdc1 /srv/data
mount -o ro,noexec /dev/sdd1 /mnt/usb

Verify in this order

filesystem created → fstab/mount unit → mounted at boot → accessible at the mount point

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=357

Confirmation

Confirm action

Continue?