15

I have installed centOS 7 on my machine and I am using it for last 4-5 month it was working fine. But few days back due to power cut (un-proper shut down) there is something bad happened with my machine. Now when I start system it gives me this message in the beginning.

XFS (dm-0): Internal error XFS_WAIT_CORRUPTED at line 1600 of file fs/xfs/libxfs/xfs_alloc.c. Caller xfs_free_extent+0xf9/0x130 [xfs]
XFS (dm-0): Failed to recover EFIs

With an ending error message

...
Mounting /sysroot...
[  ***] A start job is running for /sysroot (3min 59s / 4min 31s)[240.527013] INFO: task mount:406 blocked for more than 120 seconds.
[  240.527056] "echo 0 > /proc/sys/kernel/hung_task_timeout+secs" disables this message."
[FAILED] Failed to mount /sysroot.
See 'systemctl status sysroot.mount' for more details.
[DEPEND] Dependency failed for Initrd Root File System.
[DEPEND] Dependency failed for Reload Configration from the Real Root.
[  OK  ] Stopped dracut pre-pivot and cleanup hook.
[  OK  ] Stopped target Initrd Default Target.
[  OK  ] Reached target Initrd File System.
[  OK  ] Stopped dracut mount hook.
[  OK  ] Stopped target Basic System.
[  OK  ] Stopped System Initialization.
         Starting Emergency Shell...

Genrating "/run/initramfs/rdsosreport.txt"

Entering emergancy mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to usb stick or /boot
after mounting them and attach it to a bug report.

:/#

There can be to solution for this problem

  1. Fix this error (Corrupted files).
  2. Reinstall (Repair) the whole operating system. Like we normally do in windows.

Please guide to how to do any one of the above to solve my problem .

Note: Please let me know if there is another way to reinstall OS without loosing old data.

Edit:1 I run the xfs_repair with live-cd and the output is

sudo xfs_repair -v /dev/dm-0

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Phase 1 - find and verify superblock...
superblock read failed, offset 0, size 524288, ag 0, rval -1

fatal error -- Input/output error
5
  • Have you tried looking at the logs like the prompt suggests?
    – jsbillings
    Commented Jan 14, 2017 at 3:33
  • Yes but it's a very long file and I don't know where to look for problem, I also don't know how to copy that text to post here. but in the end of that file there is same message as above I mentioned. Commented Jan 14, 2017 at 3:52
  • I didn't updated the kernel myself or updated it without knowing is there any way to switch back to old kernel so it will work again ? Commented Mar 27, 2017 at 8:33
  • It looks like a failing drive or, at least, a corrupted superblock. Commented Apr 12, 2017 at 21:39
  • It doesn't look like hard disk is failing there is no such message system bootup, I don't want to format the hard disk and reinstall everything because it took a lot time to setup everything and if I'll then after some time (long time) this error could occur again so I want perfect solution, like there is in windows Commented Apr 13, 2017 at 2:35

4 Answers 4

37

In my case, the following command helped.

sudo xfs_repair -v -L /dev/dm-0

My node failed to boot after a power outage and got the error "Failed to mount /sysroot" and entered into emergency mode.

Mount and unmount failed so just went ahead to run with -L option and that helped my node boot up again.

4
  • 2
    This answer needs some more love. I tried running the above commands and nothing was working. The sudo in this seemed to also not work but the primary command (xfs_repair) with the -L command fixed everything, thanks so much!
    – CMOS
    Commented Apr 23, 2018 at 17:36
  • I install CentOS7 in virtualBox. After I reboot host machine(long press power button) I got this error. After running above command everything is OK . It is working for me. ;)
    – xxy
    Commented May 7, 2019 at 1:32
  • came to agree and send some more love to this answer. I mean ...what a life saver!! kudos <3 Commented Sep 14, 2020 at 22:03
  • 2
    xfs_repair -L /dev/sda3 worked for me. Commented Mar 18, 2021 at 9:36
3

It sounds like you need to run XFS Repair. The power outage must have left the file system in a bad state.

8
  • I tried but didn't get any result Commented Jan 14, 2017 at 17:00
  • What result did you get, exactly?
    – jsbillings
    Commented Jan 14, 2017 at 17:01
  • I am getting nothing after waiting for a while just blink cursor :/# xfs_repair /dev/dm-0 _ Commented Jan 15, 2017 at 7:12
  • Can you run it with -v to run in verbose mode?
    – jsbillings
    Commented Jan 15, 2017 at 23:01
  • 1
    His updated question includes a superblock read error. So, failed disk or failed superblock. You may want to update your answer to include how to specify a backup superblock. I don't know XFS well enough to write it myself. Commented Apr 12, 2017 at 21:40
2

You can do some XFS Repair...

You should run xfs_repair ? because if mount fails and journal contain dirty logs then xfs_repair does not run, we are forced to use (-L) option but its description say that (-L) can corrupt the file system.

If xfs mount successfully, even in that case accessing some files give IO input/ output error.

Its recommend the following usage for xfs_repair so that you do not come accross these problem Mount Success -> Umount -> run xfs_repair -> mount Mount fails -> try xfs_repair -> xfs_repair fails -> finally xfs_repair -L -> mount

Adding above mount + xfs_repair procedure makes file system stable

1
  • Please explain what command I have to execute Commented Apr 14, 2017 at 6:01
1

Based on your updated information, this disk is corrupted beyond repair. It may be a transient problem which a reinstall will fix — or, there may be actual damage to the drive. I would consider just replacing the drive as the least-worrysome option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .