I created a filesystem like this:
dd if=/dev/zero of=disk-image count=40960
filesystem is created with this:
/sbin/mkfs -t ext3 -q disk-image
I then mounted and copied some test files and unmounted like this:
mount -o loop disk.image foo
cp "something" foo
sudo umount foo
I then run a e2fsck -c -c disk-image
which returns
"Pass 1: Checking inodes, blocks, and sizes
Inode 185, i_size is 16384, should be 17408. Fix<y>? yes
My question, since this is a file and not a block device, is the above warning something that I should be worried about.
How does one go about doing an fsck on a filesystem that is in a file?
You just run e2fsck
and specify the image file, just like you would for a block device. I’m not sure why you’re using the -c
option (this checks for badblocks).
% 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
Is the -c option to e2fsck even valid since this is a file and not a block device?.
– user124464Jun 12, 2012 at 23:33
@user124464 It’s still valid in that e2fsck
will do the badblocks test if you tell it to, but there’s no real reason to use it.
– mgorvenJun 12, 2012 at 23:35
I have a user that is hung up on the bad blocks being returned from e2fsck -c. Is there a link or an explanation why -c is not the correct option. I tried to explain that since it is checking a file and not a block device, don’t worry about the error.
– user124464Jun 12, 2012 at 23:49
this source from : https://serverfault.com/questions/398109/fsck-a-filesystem-in-a-file