bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Workaround for extracting archives sparsely


From: markk
Subject: [Bug-tar] Workaround for extracting archives sparsely
Date: Fri, 11 Mar 2011 21:10:53 -0000
User-agent: SquirrelMail/1.4.21

Hi,

A few weeks ago I suggested that tar be given the ability to extract files
from archives sparsely. That is, files which contain runs of all-zero
bytes would be extracted as sparse files. [That's useful for saving disk
space, reducing disk I/O and making extracted files faster to work with.]

Currently neither GNU tar nor star can do that, but the FreeBSD version of
tar can. It's in the bsdtar package in Debian-based Linux distributions.

That could potentially be useful if you have tar archives you want to
convert from non-sparse to sparse. Extract using bsdtar then re-create the
archive using GNU tar with --sparse. (You can't just extract with GNU tar
then re-archive using --sparse, because that only archives sparse files
sparsely; it doesn't scan non-sparse files looking for all-zero regions.)

A quick demo:

$ ddpt if=/dev/zero of=2mb_zero.bin bs=1024 count=2048
2048+0 records in
2048+0 records out
time to transfer data: 0.002624 secs at 799.22 MB/sec

$ du 2mb_zero.bin
2048    2mb_zero.bin

$ tar -cf test_gnu.tar 2mb_zero.bin
$ du  *
2048    2mb_zero.bin
2052    test_gnu.tar

$ rm 2mb_zero.bin
$ bsdtar --version
bsdtar 2.6.2 - libarchive 2.6.2
$ bsdtar -v -v -S -x -f test_gnu.tar
x 2mb_zero.bin: Write request too large
bsdtar: Error exit delayed from previous errors.

$ du --bytes *
2097152 2mb_zero.bin
$ du -a *
0       2mb_zero.bin

I'm not sure what the error message output by bsdtar was; maybe that's
fixed in a more recent version?


Mark





reply via email to

[Prev in Thread] Current Thread [Next in Thread]