網頁

網頁清單

2012年11月25日 星期日

Linux 開機不能開機 fsck check filesystem


What is said is 
Checking filesysytems
/dev/mapper/vg_davis-lv_root contains a file system with errors, forced check. Inodes that were part of a corrupted orphan linked list found.
/dev/mapper/vg_davis-lv_root: Unexpected Inconsistency ; Run fsck manually.
(ie without -a 0r -p options)

An error occured during the file system check.
Dropping you to shell; the sysytem will reboot when you leave the shell.
Give root password for maintenance (or type Control-D to continue)


When I do control D I get right back here. I tried the rescue disc but am messing something up. It also got me to the shell and then I was lost.

Sean

Quite a typical situation when the filesystem is shut uncleanly.

What you have to do is to type in the root password (as you are asked; Ctrl-D aborts the boot sequence, so when you just reboot you are back in the same place), and then to execute the fsck command which checks and repairs corrupt file systems. Probably the command you have to execute is

fsck /dev/mapper/vg_davis-lv_root
         (藍色依自己電腦設定)
(I personally do not have any logical volumes on any of my computers.)

以下複製form 鳥哥


  • fsck
[root@www ~]# fsck [-t 檔案系統] [-ACay] 裝置名稱
選項與參數:
-t  :如同 mkfs 一樣,fsck 也是個綜合軟體而已!因此我們同樣需要指定檔案系統。
      不過由於現今的 Linux 太聰明了,他會自動的透過 superblock 去分辨檔案系統,
      因此通常可以不需要這個選項的囉!請看後續的範例說明。
-A  :依據 /etc/fstab 的內容,將需要的裝置掃瞄一次。/etc/fstab 於下一小節說明,
      通常開機過程中就會執行此一指令了。
-a  :自動修復檢查到的有問題的磁區,所以你不用一直按 y 囉!
-y  :與 -a 類似,但是某些 filesystem 僅支援 -y 這個參數!
-C  :可以在檢驗的過程當中,使用一個長條圖來顯示目前的進度!

EXT2/EXT3 的額外選項功能:(e2fsck 這支指令所提供)
-f  :強制檢查!一般來說,如果 fsck 沒有發現任何 unclean 的旗標,不會主動進入
      細部檢查的,如果您想要強制 fsck 進入細部檢查,就得加上 -f 旗標囉!
-D  :針對檔案系統下的目錄進行最佳化配置。

範例一:強制的將前面我們建立的 /dev/hdc6 這個裝置給他檢驗一下!
[root@www ~]# fsck -C -f -t ext3 /dev/hdc6 
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
vbird_logical: 11/251968 files (9.1% non-contiguous), 36926/1004046 blocks
# 如果沒有加上 -f 的選項,則由於這個檔案系統不曾出現問題,
# 檢查的經過非常快速!若加上 -f 強制檢查,才會一項一項的顯示過程。

範例二:系統有多少檔案系統支援的 fsck 軟體?
[root@www ~]# fsck[tab][tab]
fsck         fsck.cramfs  fsck.ext2    fsck.ext3    fsck.msdos   fsck.vfat
這是用來檢查與修正檔案系統錯誤的指令。注意:通常只有身為 root 且你的檔案系統有問題的時候才使用這個指令,否則在正常狀況下使用此一指令, 可能會造成對系統的危害!通常使用這個指令的場合都是在系統出現極大的問題,導致你在 Linux 開機的時候得進入單人單機模式下進行維護的行為時,才必須使用此一指令!
另外,如果你懷疑剛剛格式化成功的硬碟有問題的時後,也可以使用 fsck 來檢查一硬碟呦!其實就有點像是 Windows 的 scandisk 啦!此外,由於 fsck 在掃瞄硬碟的時候,可能會造成部分 filesystem 的損壞,所以『執行 fsck 時, 被檢查的 partition 務必不可掛載到系統上!亦即是需要在卸載的狀態喔!
不知道你還記不記得第六章的目錄配置中我們提過, ext2/ext3 檔案系統的最頂層(就是掛載點那個目錄底下)會存在一個『lost+found』的目錄吧! 該目錄就是在當你使用 fsck 檢查檔案系統後,若出現問題時,有問題的資料會被放置到這個目錄中喔! 所以理論上這個目錄不應該會有任何資料,若系統自動產生資料在裡面,那...你就得特別注意你的檔案系統囉!
另外,我們的系統實際執行的 fsck 指令,其實是呼叫 e2fsck 這個軟體啦!可以 man e2fsck 找到更多的選項輔助喔! 

沒有留言:

張貼留言