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

這裏僅僅介紹了一些原理,具體不同的應用場景對應的操作方法參見《linux斷電開機後進入repair system解決方法 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章