[lug] Convertion of ext4 Sparse Files

Zan Lynx zlynx at acm.org
Fri Jan 5 17:23:01 MST 2018


On 1/5/2018 5:01 PM, stimits at comcast.net wrote:
> Filesystem type is ext4 without any of the 64bit or csum_metadata 
> extensions. Plain and simple. When I copy this partition via dd I
> can "sudo mount -o loop,ro file.img /mnt" without issue...this
> includes the file as it was originally created, plus the file which
> is taken from the written partition which in turn was written via a
> sparse image of the original.
> 
> I didn't make it sparse, an embedded system flash tool did this. The 
> tool copies large partitions over USB2, e.g., 15 to 30GB. The tool 
> added conversion to a sparse image prior to flashing in order to
> save time (literally, hours). Some people have inherited sparse
> images they want to use on loopback mount without re-flashing, but
> the sparse images cannot be loopback mounted. So conversion back to
> the original non-sparse format is desired.

I am beginning to suspect that this file is not "sparse" as the rest of 
us think of it. It sounds to me that this tool stored the disk image in 
some compressed format and called it sparse.

Because loopback mounting works perfectly fine on sparse files. I do it 
all the time. I made a sparse OpenWRT/LEDE image just the other week. 
Both loopback and qemu liked it.



More information about the LUG mailing list