Blocking factors

Information is written to a tape in chunks of data called blocks. The blocking factor refers to the size of a block of data. The same block size, which is usually a common size, such as 512, 1024, 10240, or variable, must be used for writing and reading data. For example, System V-style computers often default to a blocking factor of 512, while Berkeley Software Distribution-styled systems default to a variable blocking factor. The blocking factor used on a tape depends upon several factors: the configuration of the system, the commands issued using the mt utility, and the blocking factor specified by the command that wrote the tape data (usually tar(1)).

If you do not know the blocking factor, you might find it very difficult to read the tape. When writing to a tape on a non-Interix system, you can specify a blocking factor with the dd(1) command. Later, when you read the tape on an Interix system, you will know the blocking factor. For example, you can create a blocking factor of 10240 on an System V Release 4.0 (SVR4) system with the following command:

tar cvf - . | dd of=/dev/tape obs=10240

The of option defines the output file; obs defines the block size. Although the dd command overrides any system-specific values for tar, it might be necessary to set the tape-device block size. Different systems use different commands. For example, you might need to set a blocking factor with either the tapecntl or mt(1) utility, and then create a tar archive. If you use tapecntl, which is available on SVR4 and other systems, you can type:

tapecntl -f 10240
tar cvf - . | dd of=/dev/tape obs=10240

Within Interix, you should be able to read the results of the previous tapecntl and tar commands by using the following:

dd if=/dev/tape0 ibs=10240 | tar xvf -

In some instances, even though you have correctly specified a blocking factor in Interix, you might also need to set the correct blocking factor on the Windows tape device. The mt subcommand setblk sets the block size:

mt setblk 10240 $ dd if=/dev/tape0 ibs=10240 | tar xvf -

Reading tapes created in Interix

When you use a non-Interix system to read a tape that was created on an Interix system, you can use tapecntl or mt and dd to set the blocking factor. For example:

tapecntl -b 10240

or

mt setblk 10240
dd if=/dev/tape ibs=10240 | tar xvt