Not able to mount sysroot- Recovery of RHEL/CentOS

Error after OS Reboot

Many times, if linux partitions if not mounted properly or resized with correct steps (Refer my Blog: Linux partition resizing using LVM), may lead to machine going in grub recovery mode or rescue mode. Now, reasons why this may happen is not part of this blog. What I am covering here is one type of error which if you may find in error logs and how to recover system from it.

Below is what happened to my RHEL VM when I rebooted it.

Figure 1

Entering emergency mode gives us privilege to run more number of commands compared to grub rescue mode. You may click “TAB” to figure out options available to run in this mode.

For me, system messgae suggested to use journalctl utlility and identify error cause. (For more on journalctl, refer my Blog: Use of journalctl to read Syslogs).

Figure 2

In figure 2, I have actually identified error which is leading to system going in emergency mode. My operating system is unable to mount /sysroot , thereby not providing system critical processes, files and information to boot linux.

Now like I said, this failure to mount sysroot may be because of multiple reasons but to recover it we can use xfs_repair utility of linux. We need to keep in mind here that this utility is only uself if we have created our partitions with Type xfs. If you using ext4 type, we may need other utilities.

xfs_repair -v -L /dev/mapper/

In above command, /dev/<device mapper name of your root partition > shall be replaced. I found my device mapper name from error logs in figure 2.

Reboot you system after repairing finishes. If indeed we have problem with blocks of disk mounted for root partition, you are good to go and login prompt shall be coming post reboot.

For me, issues didn’t end up here and I found problem with few more partitions with Error “Dependency Failed for /var partition” . Refer my blog for recovering this error.

Figure 3

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s