I use a script to partition and format CF cards (connected with a USB card writer) in an automated way. After the main process I check the card again with fsck. To check bad blocks I also tried the '-c' switch, but I always get a return value != 0 and the message "FILE SYSTEM WAS MODIFIED" (see below). I get the same result when checking the very same drive several times...
Does anyone know why a) the file system is modified at all and b) why this seems to happen every time I check and not only in case of an error (like bad blocks)?
Here's the output:
linux-box# fsck.ext3 -c /dev/sdx1
e2fsck 1.40.2 (12-Jul-2007)
Checking for bad blocks (read-only test): done
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
Volume (/dev/sdx1): ***** FILE SYSTEM WAS MODIFIED *****
Volume (/dev/sdx1): 5132/245760 files (1.2% non-contiguous), 178910/1959896 blocks
Quoth the manpage:
Therefore the
-c
option writes to the filesystem, whichfsck
interprets as "correcting errors", hence the return code of1
("File system errors corrected")...so, you ask, why does it return
1
when you specify-n
, which should open the filesystem read-only and make no changes?Well, further reading of the manpage reveals that answer too:
(in other words: The
-n
is a lie!)This answer brought to you entirely by the manpage for
fsck.ext3
.Did you try the -v switch to fsck to get more information? Also you can try to run badblocks alone and examine its output.
Most likely there was a write to the filesystem "label" area. What about the date/time last fsck'd and the number of times since the last mount count fields in the filesystem label?
If you look at the tune2fs parameters, this would type of write would support the -c and -i parameters for the automatic full fsck support for an ext3 filesystem.