I have a 64 GB Linux disk image with ~50 GB of unused space across the partitions. The file is sparse, so it only takes ~14 GB on disk.
But if I
dd the image, it writes the full 64 GB, which takes quite a while.
Is there any way I can do the equivalent of
dd if=os.img of=/dev/device with this image, without having to write 50 GB of zeros?
Is there any tool that is smart enough to do this i.e. an imaging tool that has an awareness of the EXT4 filesystem?
dd can handle this. You need to add
conv=sparse to the command line.
From the man page:
try to seek rather than write the output for NUL input blocks
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.