Go to the previous, next section.


(This message will disappear, once this node revised.)

When writing to tapes, tar writes the contents of the archive in chunks known as blocks. To change the default blocksize, use the `--block-size=512-size' (`-b 512-size') option. Each block will then be composed of size records. (Each tar record is 512 bytes.

FIXME: xref Archive Format
.) Each file written to the archive uses at least one full block. As a result, using a larger block size can result in more wasted space for small files. On the other hand, a larger block size can ofter be read and written much more efficiently.

Further complicating the problem is that some tape drives ignore the blocking entirely. For these, a larger block size can still improve performance (because the software layers above the tape drive still honor the blocking), but not as dramatically as on tape drives that honor blocking.

Wher reading an archive, tar can usually figure out the block size on itself. When this is the case, and a non-standard block size was used when the archive was created, tar will print a message about a non-standard blocking factor, and then operate normally. On some tape devices, however, tar cannot figure out the block size itself. On most of those, you can specify a blocking factor (with `--block-size=512-size' (`-b 512-size')) larger than the actual blocking factor, and then use the `--read-full-blocks' (`-B') option. (If you specify a blocking factor with `--block-size=512-size' (`-b 512-size') and don't use the `--read-full-blocks' (`-B') option, then tar will not attempt to figure out the blocking size itself.) On some devices, you must always specify the block size exactly with `--block-size=512-size' (`-b 512-size') when reading, because tar cannot figure it out. In any case, use `--list' (`-t') before doing any extractions to see whether tar is reading the archive correctly.

If you use a blocking factor larger than 20, older tar programs might not be able to read the archive, so we recommend this as a limit to use in practice. GNU tar, however, will support arbitrarily large block sizes, limited only by the amount of virtual memory or the physical characteristics of the tape device.

If you are writing a compressed archive to tape with `--compress' (`-Z') or `--gzip' (`-z') (

FIXME: pxref Input and Output
), tar will not block the archive correctly. This doesn't matter if you are writing the archive to a normal file or through a pipe, but if you are writing it to a tape drive, then this causes problems. Use `--compress-blocks' or `--gzip-block' instead, to cause tar to arrange to have blocking work correctly.

Go to the previous, next section.