RedHat – Not reading root volume based on LVM

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • EXT and XFS file system
  • Rescue Mode

Issue

  • How to repair filesystem in rescue mode for Red Hat Enterprise Linux
  • System won’t load after boot, requests fsck of root file system
  • / (root) filesystem going into read-only mode.
  • How to run repair root file system (on both EXT or XFS )

Resolution

  1. Boot the system from the binary DVD or boot disc1 of the same major release as the system. Once the system has successfully booted from the ISO image and Red Hat Enterprise Linux boot screen will appear.
    For RHEL 5: Type: linux rescue without the quotes, and hit enter at the prompt. Then go to Step 2.

    [F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue] 
    
    boot: linux rescue
    

    For RHEL6: select Rescue installed system. Then go to Step 2.
    For RHEL7: select Troubleshooting, then Rescue a Red Hat Enterprise Linux system. Then go to Step 4.

  2. When prompted for language, and keyboard, provide the pertinent information for the system.
  3. When prompted to enable the network devices on the system, select: No
  4. Select: Skip when prompted to allow the rescue environment to mount Red Hat Enterprise Linux installation under /mnt/sysimage directory.
  5. If not using LVM, execute the check on the device which contains the filesystem (For ext4 filesystem use e2fsck and for xfs filesystem use xfs_repair):

    Note: please make sure to have a backup of data present in filesystem, before going for filesystem repair

    **For EXT filesystem**
    sh-3.1# e2fsck -fv /dev/sda1 
    e2fsck 1.41.12 (17-May-2010)
    [...]
    
    **For XFS filesystem**
    sh-3.1# xfs_repair /dev/sda1 
    [...]
    

    If using LVM, activate the volumes in order to scan them. Perform this task with LVM scans:

    sh-3.1# lvm pvscan
      PV /dev/sda1   VG VolGroup00   lvm2 [96.00 MB / 0    free]
      Total: 1 [3.34 GB] / in use: 1 [3.34 GB] / in no VG: 0 [0 ]
    
    sh-3.1# lvm vgscan
      Reading all physical volumes.  This may take a while...
      Found volume group "VolGroup00" using metadata type lvm2
    
    sh-3.1# lvm lvscan
      INACTIVE            '/dev/VolGroup00/LogVol00' [3.34 GB] inherit
    
    sh-3.1# lvm lvdisplay 
    
      --- Logical volume --- 
      LV Name                /dev/VolGroup00/LogVol00 
      VG Name                VolGroup00 
      LV UUID                335qTi-Ossg-32O5-yQC7-xNON-egdI-frj4et 
      LV Write Access        read/write 
      LV Status              NOT available 
      LV Size                3.34 GB 
      Current LE             107 
      Allocation             inherit 
      Read ahead sectors     0 
    
    sh-3.1# lvm vgchange -ay
      1 logical volume(s) in volume group "VolGroup00" now active
    
    **For ext filesystem**
    sh-3.1# e2fsck -fv /dev/sda1 
    e2fsck 1.41.12 (17-May-2010)
    [...]
    
    **For xfs filesystem**
    sh-3.1# xfs_repair /dev/sda1 
    [...]
    

    If using Software RAID, Initialize the RAID array first:

#mdadm --assemble --scan

Execute fsck on the md device which contains the filesystem:

**For EXT filesystem**
sh-3.1# e2fsck -f /dev/<md device name>
[...]
**For XFS filesystem**
    sh-3.1# xfs_repair /dev/sda1 
    [...]
  1. Exit the rescue mode and boot the system normally.
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s