FG

How do I convert a Linux disk image into a sparse file?

Fresh3 days ago
Mar 15, 202623672 views
Confidence Score0%
0%

Problem

I have a bunch of disk images, made with ddrescue, on an EXT partition, and I want to reduce their size without losing data, while still being mountable. How can I fill the empty space in the image's filesystem with zeros, and then convert the file into a sparse file so this empty space is not actu…

Error Output

> du -s --si --apparent-size Jimage.image 
120G Jimage.image
> du -s --si Jimage.image 
121G Jimage.image

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I convert a Linux disk image into a sparse file?

Low Risk

First of all, sparse files are only handled transparently if you seek, not if you write zeroes. To make it more clear, the example from Wikipedia does not write any zeroes, it will open the output file, seek (jump over) 5MB and then write zero zeroe…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment