linux断电后,出现fsck失败的解决方法

os启动的时候,会有个检查filesystem是否正确的操作,如果发现filesystem is inconsistent,就会自动执行fsck,导致filesystem inconsistent的最主要的原因是power off,就是我们说的硬关机。

    执行fsck的时候,如果发现无法对某个分区的filesystem进行check,fsck将会failed,然后系统进入repair filesystem模式,现象为:

Finding module dependencies;  modprobe:modprobe:can't locate module block-major-3 fsck.ext3Possibly non-existent or swap device? such device or address while trying to open /dev/hdb1 /boot: clena, 41/26104 files. 12679/104391 blocks[FAILED]

*** AN error occurred during the file system check *** Dropping you to a shell; the systm will reboot

*** when you leave the shell Give root password for maintenance

(or type Control-D to continue):

Login incorrect. (Repair filesystem) 1 #

此时,输入root密码,就会进入repair filesystem命令行,在这里可以通过暂时卸载错误的或不存在的挂载目录,来使的os正常启动,启动后可以重新对某个分区进行fsck或其他操作。这里有个问题是,在repair filesystem模式下,根分区是只读的,所以无法修改/etc/fstab来卸载某个挂载点,可以通过如下命令使其可写:

          (Repair filesystem) 1 # mount -o remount,rw /

然后就可以通过vim /etc/fstab来进行修改。

具体的操作方法根据不同的情况如下:


第一种情况:非正常关机引起的磁盘分区问题 不能正常进入系统

如下问题一般是如何引起和应该怎么样解决呢?
Finding module dependencies; 
modprobe:modprobe:can't locate module block-major-3
fsck.ext3Possibly non-existent or swap device?
such device or address while trying to open /dev/hdb1
/boot: clena, 41/26104 files. 12679/104391 blocks[FAILED]

 

*** AN error occurred during the file system check
*** Dropping you to a shell; the systm will reboot

*** when you leave the shell
Give root password for maintenance

(or type Control-D to continue):

Login incorrect.
(Repair filesystem) 1 #

 

非正常关机引起的,用fsck /dev/hdaX后reboot进入,或只用fsck来修复,只管y回车

 



第二种情况:由于/etc/fstab文件编辑错误 而引起的不能正常进入系统

解决方法就是修改/etc/fstab文件成原来正常格式 删除错误的或者是不存在的挂载目录,本来是/dev/vda1,/dev/vda2两个分区,竟然被修改成了/dev/xvda1,/dev/xvda2 。

操作:根据提示进入修复模式 Login incorrect.

(Repair filesystem) 1 # vim /etc/fstab
但是修复模式下(read-only system) 文件是被保护的不能修改 运行下面命令 把系统文件权限改成可读写(rw)

(Repair filesystem) 1 # mount -o remount,rw /
使根目录可写.即可以修复/etc/fstab文件,使之可写.然后就可以vi修改了
保存 wq

(Repair filesystem) 1 #reboot

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25370865/viewspace-774585/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25370865/viewspace-774585/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值