When I run a read-only fsck on the mounted root partition of a CentOS 5 server, it finds a number of errors. However, running a forced check upon next boot does not find any!
Here are the results of the mounted read-only check:
# 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
The way I run a forced check is by:
touch /forcefsck
echo -n "-y" > /fsckoptions
This does force fsck to run upon next boot and the "-y" option should autofix all errors, but the check doesn't find any during bootup. However, once the file system is mounted and I run the read-only check again, it finds all the same errors.
Thanks for your time,
PRL
A mounted filesystem will be inconsistent on the disk. Don't check a mounted filesystem. Straight from the horses mouth: "However, even if it is safe to do so, the results printed by e2fsck are not valid if the filesystem is mounted." -E2FSCK(8)