在一个文件中fsck一个文件系统

我创build了这样一个文件系统

dd if=/dev/zero of=disk-image count=40960 

文件系统是用这个创build的:

 /sbin/mkfs -t ext3 -q disk-image 

然后,我装载并复制了一些testing文件,并像这样卸载:

 mount -o loop disk.image foo cp "something" foo sudo umount foo 

然后我运行一个e2fsck -c -c disk-image返回

 "Pass 1: Checking inodes, blocks, and sizes Inode 185, i_size is 16384, should be 17408. Fix<y>? yes 

我的问题,因为这是一个文件,而不是一个块设备,是上面的警告我应该担心的东西。

如何做一个在文件中的文件系统的fsck?

您只需运行e2fsck并指定映像文件,就像对块设备一样。 我不知道你为什么使用-c选项(这将检查坏块)。

 % e2fsck -f ext3.img e2fsck 1.42 (29-Nov-2011) 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 ext3.img: 11/25688 files (0.0% non-contiguous), 8913/102400 blocks