1. 程式人生 > >linux斷電後,出現fsck失敗的解決方法

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來進行修改。