[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] blocking factor on tar..maybe should be more clear in man
Re: [Bug-tar] blocking factor on tar..maybe should be more clear in man page? (even info isn't clear)...
Fri, 07 Aug 2009 22:04:31 -0700
Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:18.104.22.168) Gecko/20090601 SeaMonkey/1.1.16
Linda A. Walsh wrote:
I thought the blocking factor inserted a gap in the file-stream for
synchronization (from reading the info section on tar).
No, there's no gap. Tar simply ensures that each
write to the output archive is exactly the same size.
This is due to tar's legacy as a program that writes
to and reads from tape drives.
Tape drives deal with data in "blocks" that are
similar to the "sectors" of disk drives. Because
of how tape drives work, you can only read full
blocks at a time, so the block size must be exactly
the same when reading as was used when writing.
(Although GNU tar has been experimenting with
using a large initial read, noting the size of the
block that's actually returned and then using
that size for all subsequent blocks.)
I thought -- if it used a blocking factor, and it inserted a gap into
the disk stream, then maybe it might add a few bytes every 20blocks/10K
maybe, by using a higher block size, I would get smaller tar files...
Nope, tar does not insert data between blocks.
When writing to a disk file, the only practical
implication of the block size is that the final
file is rounded up to a multiple of the block
size. This is usually not a problem for large
archives (a few kilobytes doesn't make much
difference when writing multi-gigabyte backup
files) or archives that are being compressed
(trailing zero bytes compress very well).
With most tar implementations, a larger block
size means each write to disk is larger, which
is usually more efficient.
If the tar program knows it's reading/writing
to disk, then it could (at least in theory)
be a little sloppy with the block handling
to get good performance even with a small
block size. I don't know offhand if GNU tar