How to Run fsck on Root / Partition in Redhat and Ubuntu Linux: A Complete Guide

Photo of author
Written by
Photo of author
Verified by
Updated On
— 4 min read

Running fsck, a Linux filesystem error-checking utility, on root partitions resolves issues including crashes, data loss, and system slowdowns. The guide provides step-by-step instructions for Red Hat and Ubuntu systems, and notes filesystem-specific requirements for ext4, XFS, and Btrfs.
The guide also outlines mandatory pre-check safety steps including data backups and booting into rescue or single-user mode to avoid damaging an active root filesystem, plus post-repair procedures to return the system to normal operation.


Understanding Filesystem Checks (fsck) in Linux

What is fsck and Why is It Important?

fsck, or filesystem check, is a tool that scans your disk for errors. It finds problems in how data is stored and fixes them. These errors can develop from power failures, hardware issues, or bugs. Running fsck helps prevent data corruption and ensures your system works smoothly.


Filesystem Types Supported by fsck

Linux systems use different filesystem types like ext4, xfs, and btrfs. fsck works differently depending on what filesystem you have. For example:

  • Ext4: Use e2fsck for checks.
  • Xfs: Use xfs_repair instead, which works differently.
  • Btrfs: Has its own tools like btrfs check.

Knowing your filesystem type is crucial before running fsck. Otherwise, you might cause more harm than good.

When to Run fsck on Root Partition

Run fsck if your system shows signs of disk problems. Common scenarios include:

  • Unexpected shutdowns or power cuts
  • Disk errors or bad sectors reported by SMART
  • Filesystem corruptions or boot issues
  • Before a recovery or system maintenance

Running fsck at the right moment can save your data, but doing it blindly can be risky.


How to Prepare for Running fsck on the Root Partition

Backup Critical Data Before Proceeding

Always back up your important files first. Use tools like rsync, tar, or dedicated backup software. A crash during fsck can sometimes lead to data loss or further damage. Don’t skip this step.

Identify the Root Filesystem and Mount Status

Find which device holds your root filesystem:

lsblk
df -h /
mount | grep ' on / '

If the root filesystem is mounted and writable, running fsck directly could cause problems. You want it to be unmounted or mounted as read-only during the check.

Understanding System Boot Modes (Single-User Mode / Rescue Mode)

To safely run fsck on the root partition, you need to boot into a special mode:

  • Single-user mode: Only root runs, minimal services. Good for maintenance.
  • Rescue mode: Boot from a Live CD or recovery environment to avoid mounting the root partition.

Running fsck while the root filesystem is active can damage your data, so these modes are best.


How to Run fsck on Root / Partition in Redhat Linux

Boot Into Rescue or Single-User Mode

  1. Restart your system.
  2. When the GRUB menu appears, highlight your kernel and press e.
  3. Find the line starting with linux or linux16.
  4. Add systemd.unit=rescue.target or single at the end of that line.
  5. Press Ctrl + X or F10 to boot.

You’re now in a minimal environment with limited services.

Executing fsck on the Root Filesystem

Method 1: Using fsck from Live CD or Rescue Environment

  • Boot from the Red Hat installation or rescue disk.
  • Enter rescue mode.
  • Mount the root partition as read-only:mount -o ro /dev/sdX /mnt
  • Run:fsck -f /dev/sdX
  • Fix errors as prompted.

Method 2: Running fsck in Single-User Mode

  • Remount root as read-only:mount -o remount,ro /
  • Run fsck:fsck -f /dev/sdX
  • Use -y to auto-accept repairs:fsck -fy /dev/sdX

Replace /dev/sdX with your actual root device. Confirm with lsblk.


Running fsck on Root / Partition in Ubuntu Linux

Boot to Recovery Mode or Single-User Mode

  1. Reboot your system.
  2. Hold Shift during startup to access GRUB.
  3. Select “Advanced options” > Recovery mode.
  4. Choose “root” or “Drop to root shell prompt.”

This gives you a command line environment without fully mounting the root system.

Performing Filesystem Check on Root Partition

Method 1: Using the Recovery Mode’s Filesystem Check Options

  • When in recovery, select the option to run fsck automatically.
  • Confirm the device name (look for /dev/sda1, /dev/nvme0n1p1).
  • Let fsck run and fix errors.

Method 2: Manually Running fsck in Recovery Shell

  • Remount root as read-only:mount -o remount,ro /
  • Run fsck:fsck -f /dev/sdX
  • Use -y to auto-accept repairs:fsck -fy /dev/sdX
  • Review prompts carefully before approving fixes.

Finishing Up and Restarting

Once fsck completes and errors are repaired, remount the filesystem as read-write (if needed):

mount -o remount,rw /

Then reboot with:

reboot

Your system should now load normally.


Best Practices, Tips, and Precautions for Running fsck on Root Partition

  • Always back up your data first. Ignoring this can lead to major losses.
  • Use rescue or live environments for safety.
  • Check your filesystem type before running fsck. Different filesystems need different tools.
  • Run fsck -n if you want to preview what would be fixed without making changes.
  • Automate filesystem checks during boot if you want proactive monitoring.

Conclusion

Running fsck on the root partition might seem daunting, but it’s a vital skill for system health. Protect your data by preparing properly and executing the checks in the right environment. Whether you’re using Redhat or Ubuntu, knowing the steps ensures you can maintain your system’s stability and avoid data loss. Regular filesystem health checks should become part of your system upkeep routine to catch problems early.


Share

About Author

Photo of author
Linux & WordPress Infrastructure Specialist With over 9 years of hands-on experience, Dhananjay works extensively with Linux servers, WordPress performance optimization, hosting environments, and production infrastructure. His tutorials and reviews are tested on real servers, covering Apache/Nginx, MySQL/MariaDB, PHP, cloud hosting, and security hardening. He focuses on practical, reproducible solutions used by developers, sysadmins, and website owners in real-world environments. Content is regularly reviewed and updated based on production testing.

Leave a Comment