
起動したマシンで 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 が問題を修正してもカーネルがそれを認識しない場合は問題が発生する可能性があります。