8

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
  • Have you tried looking at the logs like the prompt suggests? – jsbillings Jan 14 '17 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. – Varun Naharia Jan 14 '17 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 ? – Varun Naharia Mar 27 '17 at 8:33
  • It looks like a failing drive or, at least, a corrupted superblock. – Michael Mol Apr 12 '17 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 – Varun Naharia Apr 13 '17 at 2:35
15

In my case, this helped.

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

My node failed to boot after 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.

  • 1
    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 Apr 23 '18 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 May 7 at 1:32
  • God bless your whole family !!! – Gaurav_soni Jun 16 at 15:46
3

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

  • I tried but didn't get any result – Varun Naharia Jan 14 '17 at 17:00
  • What result did you get, exactly? – jsbillings Jan 14 '17 at 17:01
  • I am getting nothing after waiting for a while just blink cursor :/# xfs_repair /dev/dm-0 _ – Varun Naharia Jan 15 '17 at 7:12
  • Can you run it with -v to run in verbose mode? – jsbillings Jan 15 '17 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. – Michael Mol Apr 12 '17 at 21:40
1

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

  • Please explain what command I have to execute – Varun Naharia Apr 14 '17 at 6:01
0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.