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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

Change mount options for a mounted filesystem.

Unmount by mountpoint

Detach a mounted filesystem.

bashANYumountunmount
bash
sudo umount /mnt/data
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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

List loop devices

Show loop device mappings.

bashANYlosetuploopinventory
bash
losetup -a
Notes

Show loop device mappings.

Detach a loop device

Disconnect a loop device from its image file.

bashANYlosetuploopdetach
bash
sudo losetup -d /dev/loop0
Notes

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
Notes

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
Notes

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

Test all fstab entries

Validate /etc/fstab without rebooting.

bashANYfstabmountvalidation
bash
sudo mount -a
Notes

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
Notes

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
Notes

See active mount units managed by systemd.

Show parsed fstab view

Render how the system interprets /etc/fstab.

bashANYfindmntfstab
bash
findmnt --fstab
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

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
Notes

Automatically answer yes to filesystem repairs.

Repair an unmounted XFS filesystem

XFS consistency repair tool.

bashANYxfs_repairxfsrepair
bash
sudo xfs_repair /dev/sdb1
Notes

XFS consistency repair tool.

Scan a device for bad sectors

Perform a read-only bad-block scan.

bashANYbadblocksdiskscan
bash
sudo badblocks -sv /dev/sdb
Notes

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
Notes

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
Notes

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
Notes

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
Notes

Schedule a quick device self-test.

Check SMART self-test log

Review completed SMART test results.

bashANYsmartctlselftestlog
bash
sudo smartctl -l selftest /dev/sda
Notes

Review completed SMART test results.

List NVMe devices

Inventory NVMe namespaces and firmware details.

bashANYnvmeinventorystorage
bash
sudo nvme list
Notes

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
Notes

Inspect NVMe wear, temperature, and media error counters.

Recommended next

No recommendations yet.