Linux

在 CentOS 5 上使用 fsck 修復 ext3 根文件系統的問題

  • May 9, 2011

當我在 CentOS 5 伺服器的掛載根分區上執行只讀 fsck 時,它發現了許多錯誤。但是,在下次啟動時執行強制檢查沒有發現任何問題!

以下是已安裝的只讀檢查的結果:

# fsck -nCf /
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
Warning!  /dev/sda3 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 232259589 has zero dtime.  Fix? no

Inodes that were part of a corrupted orphan linked list found.  Fix? no

Inode 232259593 was part of the orphaned inode list.  IGNORED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -32194676 -(32235995--32235998) -(32236209--32236210) -(32238978--32238981) -(32239590--32239593) -(32239924--32239926) -(32241448--32241457) -(32245306--32245313) -32867401 -(36754088--36754097) +(143647672--143648620) -(143653816--143654764)
Fix? no

Free blocks count wrong for group #982 (1277, counted=1276).
Fix? no

Free blocks count wrong for group #983 (810, counted=777).
Fix? no

Free blocks count wrong for group #984 (19647, counted=19637).
Fix? no

Free blocks count wrong for group #1003 (28042, counted=28041).
Fix? no

Free blocks count wrong for group #1121 (11611, counted=11598).
Fix? no

Free blocks count wrong (227428348, counted=227427933).
Fix? no

Inode bitmap differences:  -232259589 -232259593
Fix? no

Free inodes count wrong (243391778, counted=243391739).
Fix? no


/: ********** WARNING: Filesystem still has errors **********

/: 205534/243597312 files (3.7% non-contiguous), 16161230/243589578 blocks

我進行強制檢查的方式是:

touch /forcefsck
echo -n "-y" > /fsckoptions

這確實會強制 fsck 在下次啟動時執行,並且“-y”選項應該自動修復所有錯誤,但在啟動期間檢查沒有發現任何錯誤。但是,一旦掛載了文件系統並再次執行只讀檢查,它就會發現所有相同的錯誤。

謝謝你的時間,

PRL

掛載的文件系統在磁碟上會不一致。不要檢查已安裝的文件系統。直接從馬嘴裡說:“但是,即使這樣做是安全的,如果文件系統已掛載,e2fsck 列印的結果也是無效的。” -E2FSCK(8)

引用自:https://serverfault.com/questions/267943