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, ranfsck /dev/sdb, and rebooted successfully.”
β Step-by-Step Instructions
1. Reboot into Emergency Target (Single User Mode)
- Reboot the server from OVH panel or SSH (if responsive):
reboot - On the GRUB menu:
- Press
eto edit the default boot entry. - Find the line starting with
linuxorlinuxefi. - Add this at the end of the line:
systemd.unit=emergency.target - Press
Ctrl + Xto boot.
- Press
2. (Optional) Reset Root Password
If you donβt know the root password:
- Remount root filesystem with write access:
mount -o remount,rw / - Set a new root password:
passwd - If SELinux is enabled (default), relabel:
touch /.autorelabel - Reboot:
reboot
Then boot back into emergency mode again as in Step 1.
3. Identify & Unmount the Affected Filesystem
Once in emergency mode:
- Use
lsblkto locate the affected partition:lsblkFor 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 - 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
Yto 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
