DEV Community

Cover image for How to fix RHEL file system
Syed Sadat Ali
Syed Sadat Ali

Posted on

3

How to fix RHEL file system

How to fix RHEL file system

To boot into rescue mode in Red Hat Enterprise Linux (RHEL) 8 and check the file system for corruption, you can follow these steps:

Boot into Rescue Mode

  1. Reboot the System:
    Restart your system.

  2. Access the Boot Menu:
    During the boot process, press a key (usually Esc, F2, F12, or a similar key, depending on your system) to access the boot menu.

  3. Select Rescue Mode:
    If using GRUB bootloader, press e to edit the boot parameters of the default kernel. Use the arrow keys to navigate to the line that starts with linux and append rd.break at the end of the line. Then press Ctrl + X to boot with these parameters.

Check and Fix File System Corruption

  1. Remount the Root File System: Once you are in the rescue shell, you will need to remount the root file system in read/write mode:
   mount -o remount,rw /sysroot
Enter fullscreen mode Exit fullscreen mode
  1. Change Root into the Sysroot: Change the root to the /sysroot directory:
   chroot /sysroot
Enter fullscreen mode Exit fullscreen mode
  1. Check and Repair the File System: Use the fsck command to check and repair the file system. Replace /dev/sdXN with your actual device identifier (e.g., /dev/sda1):
   fsck /dev/sdXN
Enter fullscreen mode Exit fullscreen mode

For example, to check the root partition, you might run:

   fsck -f /dev/sda1
Enter fullscreen mode Exit fullscreen mode
  1. Exit and Reboot: After the file system check and repair are complete, exit the chroot environment:
   exit
Enter fullscreen mode Exit fullscreen mode

Remount the file system in read-only mode:

   mount -o remount,ro /
Enter fullscreen mode Exit fullscreen mode

Reboot the system:

   reboot
Enter fullscreen mode Exit fullscreen mode

Alternative Method (Using Rescue Media)

  1. Boot from Rescue Media:
    Insert the RHEL 8 installation media and boot from it. Select the Troubleshooting option from the boot menu, then select Rescue a Red Hat Enterprise Linux system.

  2. Mount the File System:
    Follow the prompts to mount the file system. The installer will detect your RHEL installation and mount it under /mnt/sysimage.

  3. Chroot into the Mounted File System:
    Change root into the mounted file system:

   chroot /mnt/sysimage
Enter fullscreen mode Exit fullscreen mode
  1. Check and Repair the File System:
    Follow the same steps as above to run fsck and repair the file system.

  2. Exit and Reboot:
    Exit the chroot environment and reboot the system:

   exit
   reboot
Enter fullscreen mode Exit fullscreen mode

You should be able to boot into rescue mode in RHEL 8 and check and fix any file system corruption.

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay