[systemd-devel] use-case for sparse tar archives

Jan Alexander Steffens jan.steffens at gmail.com
Tue Aug 18 10:50:17 PDT 2015


On Tue, Aug 18, 2015 at 6:29 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> Why would you not do this?

GNU tar's documentation mentions the main drawback:

  However, be aware that `--sparse' option presents
  a serious drawback. Namely, in order to determine
  if the file is sparse `tar' has to read it before
  trying to  archive it,  so in total  the file  is
  read *twice*.  So,  always bear in mind  that the
  time needed to process all files with this option
  is roughly twice the time needed to  archive them
  without it.

I think having to scan a multi-gigabyte file for zeroes
before archiving it would slow down the process quite a
bit.  It doesn't sound like  GNU tar  supports querying
for holes using FIEMAP or something similar.

Besides this, I guess it could be a portability issue.
libarchive tar's man page contains:

  There  is not  yet any  support for  multi-volume
  archives or for archiving sparse files.

Instead,  libarchive  supports transforming zero-filled
blocks into holes  while extracting.  It depends on the
compression to archive sparse files efficiently.


More information about the systemd-devel mailing list