[lug] Convertion of ext4 Sparse Files

Aaron D. Johnson adj at fnord.greeley.co.us
Fri Jan 5 17:52:28 MST 2018


stimits at comcast.net writes:

> The base systems tested on all run ext4. Fedora 23 through 27, plus
> Ubuntu 16.04. The partition this data belongs to is a root partition
> on an embedded system and is also ext4 (Ubuntu 16.04), without
> 64-bit extensions...it's plain vanilla ext4.
>  
> A copy of the sparse image was archived, but someone who needs to
> loopback mount this and edit without destroying a working system
> wants to know how to convert this back from sparse to
> non-sparse. The sparse image cannot be loopback mounted...perhaps it
> should be possible, but it isn't. That famous phrase the I.T. guy
> fears hearing when asked what's wrong: "It don't work!".
>  
> This sparse image was, at one point, flashed onto the embedded
> system. A clone can be created via dd, and the clone is an exact
> match of the non-sparse original image. There is a guarantee that
> when the original system was turned into sparse, and expanded during
> flash to occupy the full partition, that everything was correctly
> preserved...else it would not be possible for the clone to match the
> original. This is my original and my clone.
>
> The other guy looking for help has only an inherited sparse image
> and a system he can't destroy. I've seen this enough times it just
> seems like it should be possible to convert sparse back to full size
> and loopback mount, but I'm starting to fear the sparse format
> involved has something odd or non-standard about it since none of
> the usual tools work with it.

I'm going to agree with Zan's recently reply.  There's probably
something odd about your image files.

What does "file /path/to/sparse-image-file" say?  If it says
"ext[234]" what does "fsck -v -n /path/to/sparse-image-file" say?  Are
there any intersting stdout or stderr messages when the attempts to
mount it fail?  What about kernel messages?  (Run "dmesg" to get
those.)

- Aaron


More information about the LUG mailing list