Fsck 在作業系統中發現錯誤,但未使用 LiveCD

Fsck 在作業系統中發現錯誤,但未使用 LiveCD

在已啟動的電腦上執行 fsck 會在根檔案系統上產生錯誤。為了解決這個問題,我從 LiveCD 啟動 - 但 LiveCD 實例上的 fsck 根本沒有發現任何錯誤。我還嘗試運行與啟動系統相同的二進位檔案 - 具有 0 個錯誤的相同結果。

這裡發生了什麼事?如何修復報告的錯誤? (見下文)

該機器是無頭Ubuntu 14.04,LiveCD來自Ubuntu 14.04桌面版。

當我跑步時:

fsck -v -n /dev/mapper/lvm-root -f

響應是:

fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
Warning!  /dev/mapper/lvm-root is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
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
Block bitmap differences:  -(24598720--24598781) +(42616517--42616542) -(47432723--47432748) +(49925184--49925211) +(49925312--49925373)
Fix? no

Free blocks count wrong for group #750 (22700, counted=22638).
Fix? no

Free blocks count wrong for group #1300 (13150, counted=13176).
Fix? no

Free blocks count wrong for group #1447 (24124, counted=24098).
Fix? no

Free blocks count wrong for group #1523 (32016, counted=32106).
Fix? no

Free blocks count wrong (30301182, counted=30319341).
Fix? no

Inode bitmap differences:  -11927698 +11927700
Fix? no

Free inodes count wrong (15762199, counted=15762204).
Fix? no


/dev/mapper/lvm-root: ********** WARNING: Filesystem still has errors **********


      130281 inodes used (0.82%, out of 15892480)
        1113 non-contiguous files (0.9%)
         112 non-contiguous directories (0.1%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 121424/640
    33268738 blocks used (52.33%, out of 63569920)
           0 bad blocks
           3 large files

      101907 regular files
       19700 directories
           2 character device files
           0 block device files
           2 fifos
          22 links
        8624 symbolic links (8166 fast symbolic links)
          32 sockets
------------
      130289 files

為了解決這個問題,我從 Ubuntu 14.04 LiveCD 啟動並執行相同的命令:

root@ubuntu:~# fsck -n -v /dev/mapper/lvm-root -f
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
Warning!  /dev/mapper/lvm-root is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
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

      130281 inodes used (0.82%, out of 15892480)
        1114 non-contiguous files (0.9%)
         112 non-contiguous directories (0.1%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 121429/640
    33268738 blocks used (52.33%, out of 63569920)
           0 bad blocks
           3 large files

      101908 regular files
       19704 directories
           2 character device files
           0 block device files
           2 fifos
          22 links
        8625 symbolic links (8167 fast symbolic links)
          31 sockets
------------
      130294 files 

沒有錯誤,我覺得很奇怪。所以我嘗試掛載根分區,並手動運行位於 /sbin/fsck 下的 fsck:

root@ubuntu:~# /mnt/sbin/fsck -n -v /dev/mapper/lvm-root -f
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
Warning!  /dev/mapper/lvm-root is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
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

      130281 inodes used (0.82%, out of 15892480)
        1114 non-contiguous files (0.9%)
         112 non-contiguous directories (0.1%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 121429/640
    33268738 blocks used (52.33%, out of 63569920)
           0 bad blocks
           3 large files

      101908 regular files
       19704 directories
           2 character device files
           0 block device files
           2 fifos
          22 links
        8625 symbolic links (8167 fast symbolic links)
          31 sockets
------------
      130294 files 

答案1

在已安裝的檔案系統上執行 fsck 將顯示與此時關閉系統電源時發生的錯誤相同的錯誤;磁碟上的狀態不一致,因為更新已緩衝在記憶體中但尚未寫入磁碟。因此不要這樣做!

僅在未掛載的檔案系統上執行 fsck。即使在只讀安裝的檔案系統上,如果 fsck 修復了問題而核心不知道,也可能會出現問題。

相關內容