Hi there,

While doing some tests on managing KVM's .qcow2 files, I discovered the
following behaviour in GNU tar:

`tar --use-compress-prog=pbzip2 -cSf archive.tar.pbz2
path/to/file.qcow2` produces a compressed tar archive as expected, but
then when that archive is extracted using `tar
--use-compress-prog=pbzip2 -xSf archive.tar.pbz2`, the extracted .qcow2
file's size  has ballooned from a 'real' size of just the contents to a
'real' size matching the entire 'apparent' size (as reported by `ls`
and `du`).

I'm no filesystem expert, and I'm new at dealing with sparse files, but
I believe the above behaviour indicates that during either archive
creation or extraction, zeros have been written where there were holes,
resulting in a non-sparse file.

I also tested both tar's own bzip2 support with `tar -cSjf`, and piping
from tar without compression to pbzip2, both of which preserved the
sparseness of the file when extracted. (The 'apparent' size matching the
storage quota I gave when creating the volume in KVM, but 'real' size
matching just the size of the contents.)

This was on a Debian Buster system, using tar 1.30 installed from the
Debian repos.


Cheers!
-- 
Chris Mitchell [they/them/their]

Say hi on Matrix chat!  My handle is @radine:matrix.org
      and you can get the app at https://riot.im

Reply via email to