Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2550001
  • 博文数量: 271
  • 博客积分: 6659
  • 博客等级: 准将
  • 技术积分: 3141
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-17 10:24
文章分类

全部博文(271)

文章存档

2016年(2)

2015年(12)

2014年(7)

2013年(19)

2012年(22)

2011年(81)

2010年(128)

分类: 系统运维

2014-05-26 14:34:16

linux 文件系统破坏,导致系统无法启动解决办法

文件系统损坏 无法进入系统

Linux下普遍采用的是ext3文件系统,ext3是一个具有日志记录功能的日志文件系统,可以进行简单的容错和恢复,但是在一个高负荷读写的ext3文件系统下,如果突然发生掉电,就很有可能发生文件系统内部结构不一致,导致文件系统破坏。
Linux在启动时,会自动去分析和检查系统分区,如果发现文件系统有简单的错误,会自动修复,如果文件系统破坏比较严重,系统无法完成修复时,系统就会自动进入单用户模式下或者出现一个交互界面,提示用户介入手动修复,现象类似下面所示:
checking root filesystem
/dev/sdb5 contains a file system with errors, check forced
/dev/sdb5:
Unattached inode 68338812
/dev/sdb5: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
(i.e., without -a or -p options)
FAILED
/contains a file system with errors check forced
an eror occurred during the file system check
****dropping you to a shell;the system will reboot
****when you leave the shell
Press enter for maintenance
(or type Control-D to continue):
give root password for maintenance
从这个错误可以看出,系统根分区文件系统出现了问题,系统在启动时无法自动修复,然后进入到了一个交互界面,提示用户进行系统修复。
这个问题发生的几率很高,引起这个问题的主要原因就是系统突然掉电,引起文件系统结构不一致。一般情况下解决此问题的办法是采用fsck命令,进行强制修复。
根据上面的错误提示,当按下“Control-D”组合键后系统自动重启,当输入root密码后进入系统修复模式,在修复模式下,可以执行fsck命令,具体操作过程如下:

文件系统已经损坏 哪怕单用户也解决不了密码问题了  最终采用系统盘 rescue 模式 进入 执行fsck 命令处理

[root@localhost /]#umount /dev/sdb5
[root@localhost /]#fsck .ext3 -y /dev/sdb5
e2fsck 1.39 (29-May-2006)
/ contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Inode 6833812 ref count is 2, should be 1. Fix? yes
Unattached inode 6833812
Connect to /lost+found? yes
Inode 6833812 ref count is 2, should be 1. Fix? yes
Pass 5: Checking group summary information
Block bitmap differences: -(519--529) -9273
Fix? yes
…… ……
/: ***** FILE SYSTEM WAS MODIFIED *****
/: 19/128520 files (15.8% non-contiguous), 46034/514048 blocks

需要注意的是,在执行fsck的时候,一定要先卸载要修复的分区,然后再执行修复操作,切记!

这个不太清楚是为什么。。
阅读(1625) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~