Sample Header Ad - 728x90

From a sparse file to a block device

3 votes
3 answers
1906 views
I have a system image sparse file which actual size is only a few MBs but the "apparent size" is about 1GB. I'm trying to write it to a block device efficiently (without the holes). Here are some none working solutions I've tried: - dd if=sparse_file of=/dev/some_dev processes the whole file including the holes, so at the end I'm getting something like 1007869952 bytes (1,0 GB) copied, 22,0301 s, 45,7 MB/s - cp --sparse=always sparse_file /dev/some_dev seems also is not working as it takes long time for few MBs (~13s) - ddrescue --sparse --force sparse_file /dev/some_dev fails with a message ddrescue: Only regular files can be sparse. (Note: it works in the opposite direction as covered here ). There are 2 other ways covered here but I'd like to use only the standard tools which are the part of Linux distribution. So is there a way to write the sparse file to a block image skipping the holes?
Asked by Artak Begnazaryan (203 rep)
Nov 26, 2014, 04:27 PM
Last activity: Mar 29, 2022, 05:00 PM