Linux Filesystems and Mounts Cheat Sheet

Mount, unmount, fstab, filesystem check, and repair workflows on Linux.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Mount and Unmount
Mount a device to a directory
sudo mount /dev/sdb1 /mnt/data

# Mount a block device using filesystem auto-detection.

Mount a filesystem read-only
sudo mount -o ro /dev/sdb1 /mnt/data

# Useful for safe inspection or recovery work.

Mount by UUID
sudo mount UUID=1234-ABCD /mnt/data

# Use a stable identifier instead of a device name.

Bind mount a directory
sudo mount --bind /srv/data /mnt/data

# Expose the same directory tree at another path.

Remount a filesystem read-write
sudo mount -o remount,rw /mnt/data

# Change mount options for a mounted filesystem.

Unmount by mountpoint
sudo umount /mnt/data

# Detach a mounted filesystem.

Lazy unmount a busy mount
sudo umount -l /mnt/data

# Detach the mount now and clean up after current users release it.

Show processes using a mountpoint
sudo fuser -vm /mnt/data

# Helpful before an unmount that fails with target is busy.

List open files under a mount
sudo lsof +f -- /mnt/data

# Find which processes still hold files on a mounted filesystem.

Inspect mount options for a path
findmnt -T /mnt/data

# Show which filesystem backs a path and how it is mounted.

Mount an ISO image with loop
sudo mount -o loop image.iso /mnt/iso

# Loop-mount a disk image file.

Attach a loop device
sudo losetup -fP disk.img

# Map a disk image file to the next free loop device.

List loop devices
losetup -a

# Show loop device mappings.

Detach a loop device
sudo losetup -d /dev/loop0

# Disconnect a loop device from its image file.

## fstab and Boot-Time Mounts
Edit fstab
sudoedit /etc/fstab

# Configure persistent mounts, swap, and mount options.

Show UUIDs for fstab entries
lsblk -f

# Collect UUIDs and labels for robust /etc/fstab entries.

Test all fstab entries
sudo mount -a

# Validate /etc/fstab without rebooting.

Reload systemd units after fstab change
sudo systemctl daemon-reload

# Useful when fstab is consumed into mount units.

Inspect generated mount units
systemctl list-units --type=mount

# See active mount units managed by systemd.

Show parsed fstab view
findmnt --fstab

# Render how the system interprets /etc/fstab.

Verify fstab syntax indirectly
sudo systemd-analyze verify /etc/fstab

# Catch syntax and boot-time mounting issues early.

Check one mount unit
systemctl status mnt-data.mount

# Inspect mount unit logs and status from systemd.

Search logs for mount failures
journalctl -b | grep -i mount

# Review boot logs when a filesystem did not mount.

Build a systemd unit name for a path
systemd-escape -p --suffix=mount /mnt/data

# Convert a path into the corresponding systemd mount unit name.

## Check and Repair
Run fsck on an unmounted filesystem
sudo fsck /dev/sdb1

# Dispatch to the correct fsck helper based on filesystem type.

Force an ext filesystem check
sudo e2fsck -f /dev/sdb1

# Run a full ext filesystem check even if marked clean.

Auto-fix ext filesystem issues
sudo e2fsck -y /dev/sdb1

# Automatically answer yes to filesystem repairs.

Repair an unmounted XFS filesystem
sudo xfs_repair /dev/sdb1

# XFS consistency repair tool.

Scan a device for bad sectors
sudo badblocks -sv /dev/sdb

# Perform a read-only bad-block scan.

Destructive bad-blocks write test
sudo badblocks -wsv /dev/sdb

# Use only on disks you can erase completely.

Show SMART overall health
sudo smartctl -H /dev/sda

# Quick disk health check for SMART-capable devices.

Show full SMART data
sudo smartctl -a /dev/sda

# Inspect temperatures, reallocated sectors, and error logs.

Run a short SMART self-test
sudo smartctl -t short /dev/sda

# Schedule a quick device self-test.

Check SMART self-test log
sudo smartctl -l selftest /dev/sda

# Review completed SMART test results.

List NVMe devices
sudo nvme list

# Inventory NVMe namespaces and firmware details.

Read NVMe SMART log
sudo nvme smart-log /dev/nvme0

# Inspect NVMe wear, temperature, and media error counters.

Recommended next

No recommendations yet.