网站首页 > 技术教程 正文
有时碰到文件系统损坏无法进行系统的情况,下文记录一下如何通过linux的救援模式进行文件系统修复。
Environment
Red Hat Enterprise Linux 8
Red Hat Enterprise Linux 7
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 5
EXT and XFS file system
Rescue Environment
Issue
How to repair a filesystem in the rescue environment for Red Hat Enterprise Linux
A 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.
- 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.
Install or upgrade an existing system
Install system with basic cideo driver
Rescue installed system <--- Select
Boot from local drive
Memory test
- For RHEL7 and 8: select Troubleshooting, then Rescue a Red Hat Enterprise Linux system. Then go to Step 4. Below example is for RHEL 7 but applicable to RHEL8 as well
Install Red Hat Enterprise Linux 7.0
Test this media & install Red Hat Enterprise Linux 7.0
Troubleshooting <--- Select
Install Red Hat Enterprise Linux 7.0 in basic graphics mod
Rescue a Red Hat Enterprise Linux system <--- Select
Run a memory test
Boot from local drive
Return 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.
- For EXT filesystem
sh-4.2# e2fsck -fvy /dev/mapper/<vg>-<lv>
or
sh-4.2# e2fsck -fvy /dev/<sd device>
or
sh-4.2# e2fsck -fvy /dev/<md device>
- For XFS filesystem
sh-4.2# xfs_repair /dev/mapper/<vg>-<lv>
or
sh-4.2# xfs_repair /dev/<sd device>
or
sh-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
- Filesystems can become corrupted for a variety of reasons, the most notable of which are:
- Connection failure(s) during write
- Bad hardware(intermittent hardware failure)
- Bad cables/fabric
- Power loss
- Faulty network connections
- Flapping on nic
- Software/firmware bugs
- Incorrect file system resize operations, such as logical volume resizing
- 上一篇: Linux文件系统Ext
- 下一篇: linux被挖矿两次,终极排查经验
猜你喜欢
- 2025-04-27 如何用各种编程语言杀死一条龙
- 2025-04-27 如何进行 CentOS 8 最小安装?
- 2025-04-27 勒索病毒应急响应自救手册
- 2025-04-27 安全运维之应急响应——手把手教你进行主机入侵排查
- 2025-04-27 科普:俄太空机器人“何许人也”
- 2025-04-27 深入解构LVM:从物理卷到逻辑卷
- 2025-04-27 第五十天-ceontOS6.8上安装vsftpd
- 2025-04-27 Linux这5大磁盘分区工具,绝了
- 2025-04-27 险!司机疲劳驾驶致车辆翻入20米深沟 湖北竹山消防成功营救伤者
- 2025-04-27 如何在 Linux 中创建 Systemd 服务?
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)