πŸ”§ How to Run fsck on OVH AlmaLinux 9 Server (Filesystem Repair)

Here is a tailored guide for AlmaLinux 9 on an OVH instance to fix filesystem issues using fsck:


If your AlmaLinux 9 server fails to boot or shows filesystem-related errors (especially with /home or /dev/sdb), follow these steps to fix it using fsck.


πŸ“Œ Scenario Example:

“From boot logs, the issue was with /dev/home. I reset the password in single user mode, entered maintenance mode, unmounted /home, ran fsck /dev/sdb, and rebooted successfully.”


βœ… Step-by-Step Instructions


1. Reboot into Emergency Target (Single User Mode)

  1. Reboot the server from OVH panel or SSH (if responsive): reboot
  2. On the GRUB menu:
    • Press e to edit the default boot entry.
    • Find the line starting with linux or linuxefi.
    • Add this at the end of the line: systemd.unit=emergency.target
    • Press Ctrl + X to boot.

2. (Optional) Reset Root Password

If you don’t know the root password:

  1. Remount root filesystem with write access: mount -o remount,rw /
  2. Set a new root password: passwd
  3. If SELinux is enabled (default), relabel: touch /.autorelabel
  4. Reboot: reboot

Then boot back into emergency mode again as in Step 1.


3. Identify & Unmount the Affected Filesystem

Once in emergency mode:

  1. Use lsblk to locate the affected partition: lsblk For example: sda 8:0 0 100G 0 disk β”œβ”€sda1 8:1 0 1G 0 part /boot β”œβ”€sda2 8:2 0 50G 0 part / └─sda3 8:3 0 49G 0 part /home
  2. Unmount the partition (e.g., /home): umount /home

4. Run fsck to Repair the Filesystem

Run fsck on the device (replace with your actual partition name):

fsck /dev/sda3
  • When prompted, press Y to fix all errors.

Repeat until no more errors are reported.


5. Reboot the Server

Once fsck completes:

reboot

βœ… Expected Result

The server should now boot normally and mount all filesystems cleanly.


πŸ”’ Tip: Prevent Future Issues

  • Ensure clean shutdowns (avoid power cuts or forced stops).
  • Monitor disk health using: smartctl -a /dev/sda
Scroll to Top