Technical article 119512

What is the default block size for a tape on UnixWare7/OSR6 and can it be changed?

OpenServer 6.0.0UnixWare 7.1.1UnixWare 7.1.2UnixWare 7.1.3UnixWare 7.1.4

Written · Last revised

Problem

	I would like to improve the performance of my tape reading and
        writing because by default I am seeing that the performance is
        quite slow.

Cause

	There are 2 block sizes for each tape transfer when the tape drive is
        set to fixed block mode. There is the block size used by the
        application ( dd obs=32K, for instance ) which we wi1l call the logical
        block size and there is the block size of the tape drive which we will
        call the physical block size.

Most ( but not all ) tape drives default to fixed block 512 on powerup. This is not usually the optimum physical block size for a tape transfer. Usually, a larger physical block size provides better performance. The best logical block size to use is usually the largest you can specify. Any value will work and sometimes a smaller value provides better performance depending on the size of the files being backed up. For example, several small files .vs. a few larger files.

The only caveat is that this logical block size MUST be a multiple of physical block size that the tape drive is set to.

This differs from variable length blocks to create the tape (tapecntl -v ). In this case you must always read and write the blocks in the same block size. That is if you write the tape out in 32K blocks you have to read it back in using 32K blocks.

	In all of these cases there are 2 limits to keep in mind.
        These limits only apply to the PHYSICAL block size. The first limit
        is a fundamental OS limit.  UnixWare will not generate an I/O
        larger than 128K in one request.  Any I/O request larger than 128K
        WILL be split into multiple requests no larger than 128K each.

This is relevant for DDI8 Host Bus Adapters (HBA's). With DDI7 the SCSI passthrough size was limited to 16k.

This upper limit is further limited by the specific SCSI hardware in use. Although most modern SCSI host adapters will handle a 128K transfer (via the driver), many older ones are only capable of a 64K transfer.

Thus, on these older host adapters, regardless of the tape drive employed, a physical block size for an I/O greater than 64K will result in the I/O being broken into smaller pieces. This is very bad for tapes because each I/O request results in 1 physical block being written onto the tape drive. For instance, if you use a host adapter that is limited to a 64K max transfer and set the tape drive into variable block mode and then try and do:

	# dd if=/dev/zero of=/dev/rmt/ctape1 obs=128K count=1

the I/O will complete but the result will be 2 64K blocks written to the tape, not 1 128K block.

But, if you use a host adapter capable of 128K transfers with the same tape drive and the same command, you will get 1 128K written to the tape.

If you try and read either of these tapes using the other host adapter, the I/O will fail because you are expecting to always read in a 128K block.

Solution

On OU8/UW7/OSR6 the default block size for read/write to tapes is 512bytes.

This is for older slower tape drives.

If you keep this default, then using tar/cpio/dd, etc. you get a speed of something under 500kb/s. Of course, this will depend on the hardware being used.

If you set the block size "bs" ( ibs,obs=32768 params on "dd" or -C 32768 for a 32k block size with "cpio") you find that the operation fails, so the tape drive block size must be the same as the dd/cpio block size.

So, in order to use 32k with tape drivers and cpio/dd:

	# tapecntl -f 32768
	# find / -depth -mount -print | cpio -ovc -C32768 -O /dev/rmt/ctape1
	This may write to a DLT tape with ~5000Kb/s ( 5MB/s ) or around/under
	3MB/s for a DAT DDS4 tape.  Of course, there are many things that
        affect speed such as the SCSI controller configuration, the number of
	peripherals on the bus, how busy they are, the slot the controller is
	in, the firmware version used, speed of the processor, etc.
	To read/restore the same tape first:
	# tapecntl -f 32768
	# cpio -icvdum -C32768 -I /dev/rmt/ctape1

For "tar" you can't change the block size used by the tar shipped but using tar from skunkware it supports --record-size=SIZE option ( ie: --record-size=32768 )

	See the GNU "tar" package from:
ftp://ftp2.sco.com/pub/skunkware/uw7/Packages
and:
ftp://ftp2.sco.com/pub/skunkware/osr6/vols/gnutar-1.15.1Sa-VOLS.cpio
	This will be dependant on the hardware being used, which is why 512 is
	the default.  For example, with Super DLT's and AIT 2/3, a block size
	of 65536 works well on ad160/ad320 HBA controllers.

So, the controller's transfer speed also factors into the setting up of the block size.

To test on your own tape drive run the "tapecntl" command to set the tape to whatever physical block size required then test with the "time" command, eg:

	# time sh -c 'find /<test_directory> -print | cpio -ovc -C <block_size>
	-O /dev/rmt/ctape1

NOTE: UnixWare can use a block size of 128k but various Host Bus Adapters (HBA's) limit the blocksize to 64k or less (DDI7).

This problem has been reported to SCO Engineering.

The following is a list of the UW713 HBAs that support 128K transfers:

adst70 amd c7xx c8xx ciss dak dpt ida ide qlc1020 qlc1280 qlc12160 qlc2100 qlc2200 qlc2300

	For OpenServer, the tape block size is unset by default, which means
	its up to the tape drive, and typically ends up being set to 0 which
	results in a variable block size.  This is relevant if restoring
	tapes created by an OpenServer system to a UnixWare7 system.
NOTE:   For OpenServer6, you can also change the blocksize of tape device
        using:
# tape -a <value> setblk <device>

Please check the man page of tape, the maximum allowed value is 10240.

It has to be multiples of 512

Also you can set it to variable size:

# tape -a 0 setblk <device>     Where 0 ==> variable size.

See also

	cpio(1)
	dd(1M)
        tape(c)
	tapecntl(1)
	tar(1)
	http://www.sco.com/skunkware
	ftp://ftp2.sco.com/pub/skunkware/uw7/Packages

TA116882, "How can I improve the restore performance during an emergency recovery procedure?"

TA116163, "How do I install UnixWare7 on a Compaq ML Series server?"

From the Xinuos technical article database, record 119512. Reproduced with permission. The original is at www.sco.com/ta/119512, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.