[lug] Convertion of ext4 Sparse Files

Aaron D. Johnson adj at fnord.greeley.co.us
Fri Jan 5 21:05:04 MST 2018


stimits at comcast.net writes:

> If I run fsck -v -n directly on the file it just spits out the help
> menu of fsck.  If I run this on a loopback device covering the file:
> 
> # fsck -v -n /dev/loop0
> fsck from util-linux 2.30.2 e2fsck 1.43.5 (04-Aug-2017)
> ext2fs_open2: Bad magic number in super-block
> fsck.ext2: Superblock invalid, trying backup blocks...
> fsck.ext2: Bad magic number in super-block while trying to open /dev/loop0
> 
> The superblock could not be read or does not describe a valid ext2/ext3/ext4
> filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
> filesystem (and not swap or ufs or something else), then the superblock
> is corrupt, and you might try running e2fsck with an alternate superblock:
>     e2fsck -b 8193 <device>
>  or
>     e2fsck -b 32768 <device>
>
> So it seems to be as feared...this must be a custom sparse image and
> not standard.

We can be sure it's not an image of an ext2/3/4 file system, yes.

It could be that it is an image of a partitioned blocked device of
some sort and your ext filesystem does not start on block 0.  Or a
filesystem that isn't ext2/3/4.  (You mentioned flash, so maybe JFFS2
or something.)  What does "file /path/to/image" say?  Or "file -s
/dev/loop0"?  Or "/sbin/blkid /path/to/image" ?

- Aaron


More information about the LUG mailing list