Repair Linux filesystem in rescue mode

Attach CentOS ISO image with virtual media of server and boot from virtual cdrom. When the boot screen appears type Linux rescue or selects the Linux rescue option if available.

  • Select rescue installed system.
  • Select relevant option when language and keyboard selection appears on the screen.
  • Select no for enabling network devices like eth0 or eth1.
  • If the server has software raid, enable it with mdadm --assemble --scan
  • If the server has LVM volume activate them with lvm vgchange -ay
  • check the device containing the corrupted filesystem.
  • If your server has an EXT filesystem do e2fsck -fvy /dev/sd-device or e2fsck -fvy /dev/mapper/vg-lv or e2fsck -fvy /dev/md-device
  • If your server has an XFS filesystem do xfs_repair /dev/sd-device or xfs_repair /dev/mapper/vg-lv  or xfs_repair /dev/md-device
  • In case, xfs_repair is not functional due to a missing log file, then run xfs_repair -L
  • Finally, exit the rescue shell and reboot the server.

Leave a Reply