Filesystem management

1.9 Identify common features and tools of the Linux client/desktop operating system.

📘CompTIA A+ Core 2 (220-1202)


Linux uses a filesystem to organize and manage files on storage devices (like hard drives, SSDs, or USB drives). Managing these filesystems is important because if a filesystem gets corrupted or isn’t properly attached, the OS can’t read or write data correctly. Two key tools in Linux for this are fsck and mount.


1. fsck (File System Consistency Check)

What it is:

fsck stands for File System Consistency Check.
It is a command-line tool used to check and repair Linux filesystems.

Think of it as a “health check” for your filesystem. It makes sure all the files and directories are consistent and not corrupted.


Key Points for the Exam:

  • Purpose: Detects and repairs errors in a filesystem.
  • When to use:
    • After a system crash or power failure.
    • When the OS reports filesystem errors.
    • Before mounting a filesystem that might be damaged.
  • Command syntax:
fsck [options] [device]
  • Example:
sudo fsck /dev/sda1

This checks the filesystem on the first partition of the first hard drive (/dev/sda1) and tries to fix errors.


Common Options:

  • -y → Automatically answer “yes” to repair prompts.
  • -n → Perform a read-only check (no changes made).
  • -t → Specify filesystem type (ext4, ext3, etc.). Example:
sudo fsck -t ext4 /dev/sda1

Important Notes for Exam:

  • Never run fsck on a mounted filesystem (especially the root / drive) unless it is in read-only mode. Running on a live filesystem can cause more damage.
  • You might need to run fsck from a Live CD/USB or in recovery mode for root filesystem checks.

2. mount

What it is:

mount is a command used to attach a storage device or filesystem to the Linux directory tree so the system can use it.

In Linux, all filesystems appear under a single directory tree starting at /. Mounting tells Linux where in the tree a filesystem should appear.


Key Points for the Exam:

  • Purpose: Make a filesystem accessible to the OS.
  • When to use:
    • When connecting a new drive (USB, SSD, external hard drive).
    • When accessing network storage or additional partitions.
  • Command syntax:
mount [options] device mount_point
  • Example:
sudo mount /dev/sdb1 /mnt/usb

This mounts the first partition of the second drive (/dev/sdb1) to /mnt/usb. After this, you can access files in /mnt/usb.


Common Options:

  • -t <filesystem> → Specify filesystem type (ext4, vfat, ntfs).
  • -o <options> → Mount options, such as ro (read-only) or rw (read-write).
    Example:
sudo mount -t vfat -o ro /dev/sdb1 /mnt/usb

This mounts a FAT32 USB drive as read-only.


Unmounting a Filesystem:

  • Before removing a drive, you must unmount it to prevent data loss:
sudo umount /mnt/usb

Quick Comparison / Summary

ToolPurposeKey Exam Notes
fsckChecks and repairs filesystem errorsUse on unmounted partitions; fixes corruption; often needed after crashes
mountAttaches a filesystem to the directory treeMakes a drive accessible; requires a mount point; unmount before removal

Example in an IT Environment:

  • Scenario: A USB drive isn’t working properly.
    1. IT tech runs fsck /dev/sdb1 to check and repair errors.
    2. Once clean, they mount it with mount /dev/sdb1 /mnt/usb.
    3. Files are now accessible in /mnt/usb.
    4. After work is done, they unmount it with umount /mnt/usb before safely removing it.

Exam Tip:
You may be asked:

  • Which command checks for filesystem corruption? → fsck
  • Which command mounts a drive? → mount
  • What must you do before running fsck? → Ensure the filesystem is unmounted
Buy Me a Coffee