有时碰到文件系统损坏无法进行系统的情况,下文记录一下如何通过linux的救援模式进行文件系统修复。
Environment
Red Hat Enterprise Linux 8Red Hat Enterprise Linux 7Red Hat Enterprise Linux 6Red Hat Enterprise Linux 5EXT and XFS file systemRescue Environment
Issue
How to repair a filesystem in the rescue environment for Red Hat Enterprise LinuxA system will not load after boot, and it requests a repair of an OS-dependent filesystem, i.e., typically either root or /var.The / (root) filesystem is going into read-only mode.How to repair the root or /var file system (either EXT or XFS)
Resolution
Boot the system from the binary DVD or boot disc1 of the same major release as the system. If possible, download the latest minor release available from the Downloads page at access.redhat.com. For example, it would be better to use RHEL 8.4 as opposed to RHEL 8.0 because the former will likely contain more updates/fixes than the previous minor release.
Once the system has successfully booted from the ISO image and Red Hat Enterprise Linux boot screen will appear.
[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue] boot: linux rescue
Install or upgrade an existing systemInstall system with basic cideo driverRescue installed system <--- SelectBoot from local driveMemory test
Install Red Hat Enterprise Linux 7.0Test this media & install Red Hat Enterprise Linux 7.0Troubleshooting <--- SelectInstall Red Hat Enterprise Linux 7.0 in basic graphics modRescue a Red Hat Enterprise Linux system <--- SelectRun a memory testBoot from local driveReturn to main menu
- When prompted for language, and keyboard, provide the pertinent information for the system.
- When prompted to enable the network devices on the system, select: No
- Select: Skip when prompted.
- If using Software RAID, Initialize the RAID array first.
If using Software RAID, Initialize the RAID array first.
sh-4.2# mdadm --assemble --scan
If using LVM, activate the volumes in order to scan them.
sh-4.2# lvm vgchange -ay 1 logical volume(s) in volume group "VolGroup00" now active
Execute the check on the device which contains the filesystem.
sh-4.2# e2fsck -fvy /dev/mapper/<vg>-<lv>or sh-4.2# e2fsck -fvy /dev/<sd device>orsh-4.2# e2fsck -fvy /dev/<md device>
sh-4.2# xfs_repair /dev/mapper/<vg>-<lv>orsh-4.2# xfs_repair /dev/<sd device>orsh-4.2# xfs_repair /dev/<md device>
NOTE: You may have to recreate the log if xfs_repair will not run. This can be done by running xfs_repair -L.
NOTE: Please make sure you have a known, good backup of the data present on the impacted filesystem before attempting a repair.
8、Exit the rescue environment and boot the system normally.
sh-4.2# exit
Root Cause
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!