fsck 文件中的文件系统

use*_*464 8 linux filesystems fsck

我创建了一个这样的文件系统:

dd if=/dev/zero of=disk-image count=40960
Run Code Online (Sandbox Code Playgroud)

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

/sbin/mkfs -t ext3 -q disk-image
Run Code Online (Sandbox Code Playgroud)

然后我挂载并复制了一些测试文件,然后像这样卸载:

mount -o loop disk.image foo
cp "something" foo
sudo umount foo
Run Code Online (Sandbox Code Playgroud)

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

"Pass 1: Checking inodes, blocks, and sizes
Inode 185, i_size is 16384, should be 17408.  Fix<y>? yes 
Run Code Online (Sandbox Code Playgroud)

我的问题是,由于这是一个文件而不是块设备,因此上述警告是否值得我担心。

如何在文件中的文件系统上执行 fsck?

mgo*_*ven 12

您只需运行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
Run Code Online (Sandbox Code Playgroud)