Hello,
Some time ago, I wrote a conv=sparse option for dd, attached is the
patch. The goal is to recreate a sparse file from a file with 0s.
Typically, I use it to do this:
# mount /dev/hda6 /mnt/mnt
# dd bs=1M < /dev/zero > /mnt/mnt/foo
# rm -f /mnt/mnt/foo
# umount /mnt/mnt
# dd bs=1M conv=sparse < /dev/hda6 > /mnt/savhda6
Which creates a sparse file out of my not-so-filled partition. Of
course, there may be other uses: re-sparsing a qemu image before tarring
it for public download, etc.
Maybe it could be useful to apply it mainstream?
Samuel