xfs maintenance mode in redhat 7

12,342

Solution 1

You can at least find out what's wrong by running:

xfs_repair -n /dev/mapper/rhel-root

-n runs xfs_repair in no-modify mode.

If it's complaining about it being mounted and writeable, you might want to try re-mounting it read-only (mount -r -o remount <device>), but this will probably just come back with '/dev/mapper/rhel-root is busy'.

I'd go with booting from a different medium and running xfs_check from there.

Solution 2

Boot into Emergency mode in which root-fs will be mounted as read-only. For this, add

systemd.unit=emergency.target

to the kernel parameters in GRUB when booting. After this you would be able to run:

xfs_repair -d /dev/mapper/your-root-fs

Solution 3

Boot from some live medium and perform the xfs_repair from there.

Share:
12,342

Related videos on Youtube

Sriharsha Kalluru
Author by

Sriharsha Kalluru

Linux Administrator

Updated on September 18, 2022

Comments

  • Sriharsha Kalluru
    Sriharsha Kalluru over 1 year

    In my desktop I installed redhat 7 and after reboot it went to maintenance mode, After entering the password it is not allowing to do a file system scan for root and every time it boots enters to maintenance mode and not allowing to run xfs_repair command which is showing error as it is mounted.

        # xfs_repair /dev/mapper/rhel-root 
        xfs_repair: /dev/mapper/rhel-root contains a mounted and writable filesystem.
    
        fatal error -- couldn't initialize XFS library.
    

    I tried to execute same command on other file systems which are not mounted and it is working fine.

    Please help me.

  • Sriharsha Kalluru
    Sriharsha Kalluru over 9 years
    So is there no direct way to get it done
  • Sriharsha Kalluru
    Sriharsha Kalluru over 9 years
    I tried all these but no luck, XFS always it is saying the file system is mounted even in RO/RW.