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 devices, images, and network filesystems.

Mount a device to a directory

Mount a block device using filesystem auto-detection.

bashANYmountdevice
bash
sudo mount /dev/sdb1 /mnt/data

Mount a block device using filesystem auto-detection.

Mount a filesystem read-only

Useful for safe inspection or recovery work.

bashANYmountreadonly
bash
sudo mount -o ro /dev/sdb1 /mnt/data

Useful for safe inspection or recovery work.

Mount by UUID

Use a stable identifier instead of a device name.

bashANYmountuuid
bash
sudo mount UUID=1234-ABCD /mnt/data

Use a stable identifier instead of a device name.

Bind mount a directory

Expose the same directory tree at another path.

bashANYmountbind
bash
sudo mount --bind /srv/data /mnt/data

Expose the same directory tree at another path.

Remount a filesystem read-write

Change mount options for a mounted filesystem.

bashANYmountremount
bash
sudo mount -o remount,rw /mnt/data

Change mount options for a mounted filesystem.

Unmount by mountpoint

Detach a mounted filesystem.

bashANYumountunmount
bash
sudo umount /mnt/data

Detach a mounted filesystem.

Lazy unmount a busy mount

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

bashANYumountlazybusy
bash
sudo umount -l /mnt/data

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

Show processes using a mountpoint

Helpful before an unmount that fails with target is busy.

bashANYfuserumountbusy
bash
sudo fuser -vm /mnt/data

Helpful before an unmount that fails with target is busy.

List open files under a mount

Find which processes still hold files on a mounted filesystem.

bashANYlsofmountbusy
bash
sudo lsof +f -- /mnt/data

Find which processes still hold files on a mounted filesystem.

Inspect mount options for a path

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

bashANYfindmntmountoptions
bash
findmnt -T /mnt/data

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

Mount an ISO image with loop

Loop-mount a disk image file.

bashANYmountloopiso
bash
sudo mount -o loop image.iso /mnt/iso

Loop-mount a disk image file.

Attach a loop device

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

bashANYlosetuploopimage
bash
sudo losetup -fP disk.img

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

List loop devices

Show loop device mappings.

bashANYlosetuploopinventory
bash
losetup -a

Show loop device mappings.

Detach a loop device

Disconnect a loop device from its image file.

bashANYlosetuploopdetach
bash
sudo losetup -d /dev/loop0

Disconnect a loop device from its image file.

fstab and Boot-Time Mounts

Persistent mount configuration and boot-time validation.

Edit fstab

Configure persistent mounts, swap, and mount options.

bashANYfstabpersistent-mounts
bash
sudoedit /etc/fstab

Configure persistent mounts, swap, and mount options.

Show UUIDs for fstab entries

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

bashANYfstabuuidlsblk
bash
lsblk -f

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

Test all fstab entries

Validate /etc/fstab without rebooting.

bashANYfstabmountvalidation
bash
sudo mount -a

Validate /etc/fstab without rebooting.

Reload systemd units after fstab change

Useful when fstab is consumed into mount units.

bashANYsystemdfstabreload
bash
sudo systemctl daemon-reload

Useful when fstab is consumed into mount units.

Inspect generated mount units

See active mount units managed by systemd.

bashANYsystemdmount-units
bash
systemctl list-units --type=mount

See active mount units managed by systemd.

Show parsed fstab view

Render how the system interprets /etc/fstab.

bashANYfindmntfstab
bash
findmnt --fstab

Render how the system interprets /etc/fstab.

Verify fstab syntax indirectly

Catch syntax and boot-time mounting issues early.

bashANYsystemd-analyzefstabverify
bash
sudo systemd-analyze verify /etc/fstab

Catch syntax and boot-time mounting issues early.

Check one mount unit

Inspect mount unit logs and status from systemd.

bashANYsystemctlmountstatus
bash
systemctl status mnt-data.mount

Inspect mount unit logs and status from systemd.

Search logs for mount failures

Review boot logs when a filesystem did not mount.

bashANYjournalctlmountlogs
bash
journalctl -b | grep -i mount

Review boot logs when a filesystem did not mount.

Build a systemd unit name for a path

Convert a path into the corresponding systemd mount unit name.

bashANYsystemd-escapemount-unit
bash
systemd-escape -p --suffix=mount /mnt/data

Convert a path into the corresponding systemd mount unit name.

Check and Repair

Filesystem consistency checks and repair utilities.

Run fsck on an unmounted filesystem

Dispatch to the correct fsck helper based on filesystem type.

bashANYfsckrepairfilesystem
bash
sudo fsck /dev/sdb1

Dispatch to the correct fsck helper based on filesystem type.

Force an ext filesystem check

Run a full ext filesystem check even if marked clean.

bashANYe2fsckext4repair
bash
sudo e2fsck -f /dev/sdb1

Run a full ext filesystem check even if marked clean.

Auto-fix ext filesystem issues

Automatically answer yes to filesystem repairs.

bashANYe2fsckrepairauto
bash
sudo e2fsck -y /dev/sdb1

Automatically answer yes to filesystem repairs.

Repair an unmounted XFS filesystem

XFS consistency repair tool.

bashANYxfs_repairxfsrepair
bash
sudo xfs_repair /dev/sdb1

XFS consistency repair tool.

Scan a device for bad sectors

Perform a read-only bad-block scan.

bashANYbadblocksdiskscan
bash
sudo badblocks -sv /dev/sdb

Perform a read-only bad-block scan.

Destructive bad-blocks write test

Use only on disks you can erase completely.

bashANYbadblocksdiskdestructive
bash
sudo badblocks -wsv /dev/sdb

Use only on disks you can erase completely.

Show SMART overall health

Quick disk health check for SMART-capable devices.

bashANYsmartctlsmarthealth
bash
sudo smartctl -H /dev/sda

Quick disk health check for SMART-capable devices.

Show full SMART data

Inspect temperatures, reallocated sectors, and error logs.

bashANYsmartctlsmartdisk
bash
sudo smartctl -a /dev/sda

Inspect temperatures, reallocated sectors, and error logs.

Run a short SMART self-test

Schedule a quick device self-test.

bashANYsmartctlselftestsmart
bash
sudo smartctl -t short /dev/sda

Schedule a quick device self-test.

Check SMART self-test log

Review completed SMART test results.

bashANYsmartctlselftestlog
bash
sudo smartctl -l selftest /dev/sda

Review completed SMART test results.

List NVMe devices

Inventory NVMe namespaces and firmware details.

bashANYnvmeinventorystorage
bash
sudo nvme list

Inventory NVMe namespaces and firmware details.

Read NVMe SMART log

Inspect NVMe wear, temperature, and media error counters.

bashANYnvmesmartnvme
bash
sudo nvme smart-log /dev/nvme0

Inspect NVMe wear, temperature, and media error counters.

Recommended next

No recommendations yet.