SUSE Support

Here When You Need Us

How to perform filesystem check (fsck) in the rescue mode?

This document (000020980) is provided subject to the disclaimer at the end of this document.

Environment

  • SUSE Linux Enterprise Server 12, 15
  • XFS and EXT filesystem
  • Rescue Environment

Situation

  • The system is failing to boot due to filesystem corruption
  • System requires OS filesystems to be repaired i.e., root filesystem or /var
  • How to repair /var or /(root) filesystem which are formatted with either EXT or XFS

Resolution

Note: SUSE always recommends to ensure working backup of the data is present before proceeding further with the following steps.
 
  • Boot the system into rescue mode by using the binary DVD or boot ISO. For best results use media that matches the version and service pack of the system.
  • In the rescue mode, logical volumes are automatically activated, and same can be checked with:
# lvs
  •  ​​If not, the following command can be used to manually activate the logical volumes.
# vgchange -ay
  • Following commands can be used to perform a dry-run(read-only mode) of the fsck, to approximately determine how much corruption is observed. This will not make any changes to the filesystem. These steps are recommended before going further for the actual filesystem check.  
For EXT Filesystem
# e2fsck -n /dev/mapper/<vgname>-<lvname>
OR
# e2fsck -n /dev/<sd device>
For XFS Filesystem
# xfs_repair -n /dev/mapper/<vgname>-<lvname>
OR
# xfs_repair -n /dev/<sd device>
 
  • If the actual filesystem check is required, following commands can be used
For EXT Filesystem
# e2fsck -fyv /dev/mapper/<vgname>-<lvname>
OR
# e2fsck -fyv /dev/<sd device>
For XFS Filesystem
# xfs_repair /dev/mapper/<vgname>-<lvname>
OR
# xfs_repair /dev/<sd device>
  • Note: One may need to replay/recreate the log if xfs_repair command fails. This can be achieved with xfs_repair -L command. However, this option should be treated as the last resort.
  • Exit the rescue mode and boot the system normally.

Cause

Filesystem corruption caused the system to fail while booting.
Filesystem corruption can occur due to several reasons.

Additional Information

For more information about the filesystem check commands, please refer to the following: 
  • man e2fsck
  • man xfs_repair

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020980
  • Creation Date: 20-Feb-2023
  • Modified Date:22-Feb-2023
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Server for SAP Applications

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.