linux – fsck:文件系统在每次检查后都用-c进行了修改,为什么?

我使用脚本以自动方式对CF卡(与USB卡写入器连接)进行分区和格式化.在主要过程之后,我再次使用fsck检查卡.为了检查坏块我也尝试了’-c’开关,但我总是得到一个返回值!= 0和消息“FILE SYstem WAS MODIFIED”(见下文).我几次检查同一个驱动器时得到的结果相同……

有谁知道为什么a)文件系统完全被修改和b)为什么每次我检查时都会发生这种情况,而不仅仅是在出现错误的情况下(如坏块)?

这是输出

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

解决方法

手册页:

-c
This option causes e2fsck to run the badblocks(8) program to find any blocks which are bad on the filesystem,and then marks them as bad by adding them to the bad block inode. If this option is specified twice,then the bad block scan will be done using a non-destructive read-write test.

因此-c选项写入文件系统,fsck将其解释为“纠正错误”,因此返回码为1(“文件系统错误已更正”)

…所以,你问,为什么当你指定-n时它会返回1,哪个应该以只读方式打开文件系统并且不做任何修改
好了,进一步阅读该联机帮助页也显示了答案:

-n
Open the filesystem read-only,and assume an answer of `no’ to all questions. Allows e2fsck to be used non-interactively. (Note: if the -c,-l,or -L options are specified in addition to the -n option,then the filesystem will be opened read-write,to permit the bad-blocks list to be updated. However,no other changes will be made to the filesystem.)

(换句话说:-n是谎言!)

这个答案完全由the manpage for fsck.ext3带给你.

相关文章

insmod和modprobe加-f参数导致Invalid module format错误 这...
将ArchLinux安装到U盘 几个月前入门Arch的时候上网搜了不少安...
1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...