[TriLUG] fsck an image file vs fsck a device (was: fsck.ext4 vs e2fsck)

Brian via TriLUG trilug at trilug.org
Thu Nov 13 14:01:51 EST 2025


Hi Stephen,

On this SBC, / is on a different device (/dev/mmcblk0).  /dev/sda is, in 
this case, a uSD card in a USB adapter.  I left out that detail in my 
original post.  Also, this is a non-EFI U-Boot system that understands 
ext, so there is no vfat partition.

...Okay, I'm clearly going crazy.

New day, new behavior.  I've tried three different uSD cards.  I split 
the image into the MBR and the actual first partition so that I could 
e2fsck the image.  It passes, no errors found.  Then I write that image 
to a device, e2fsck the device, and get a predictable set of errors 
(meaning I've done it a few times, and it's always the same errors on 
the same blocks, regardless of which SD card).

Then I did this:
$ dd if=part1.img of=/dev/sda1
$ dd if=/dev/sda1 of=part1.img.2
$ diff part1.img part1.img.2
# (files are identical)
$ e2fsck -f part1.img
# ... clean
$ e2fsck -f part1.img.2
# ... clean
$ e2fsck -f /dev/sda1
# ... predictable set of errors

What.  On.  Earth?

Bytes are bytes.  Bytes in a row are bytes in a row.  Clearly all the 
bytes are in a row in the right way, because the image written and the 
image read are byte-for-byte identical.  A filesystem is just a bunch of 
bytes in a particular arrangement.

e2fsck sees no errors when scanning the image, so why does it see errors 
when scanning the device?

Why is it always the same list of errors in the same places?

Why do the errors persist after e2fsck "fixes" them?

I've decided to continue on my way and ignore the fact that fsck finds 
errors when I scan the device, as there are no errors in the image and 
the image is intact, but I really want to understand why e2fsck is 
apparently seeing ghosts.

Thanks,
-Brian


On 11/11/25 17:47, Stephen Bryant wrote:
> Hey Brian!
> 
> If I remember right, `fsck` is just a wrapper than calls the right 
> filesystem-specific variant (eg. `fsck.ext4`); do you get the same 
> result when calling the specific variant directly? Also, I imagine 
> you've already checked this, but - /dev/sda1 on SBCs is usually a vfat 
> boot partition in my experience, so are you sure it's calling 
> `fsck.ext4`/`e2fsck` and not `fsck.vfat`?
> 
> Hope this is helpful, and good luck!
> Stephen
> --
> Stephen Bryant
> 



More information about the TriLUG mailing list