Accessing a VAX tape drive from a S

Chris Torek chris at mimsy.UUCP
Wed Sep 7 10:58:32 AEST 1988


>>When writing a local tape, each write() call produces one record.

This is correct.

In article <43200035 at uicsrd.csrd.uiuc.edu> kai at uicsrd.csrd.uiuc.edu writes:
>Not true when a blocking factor > 1 is used.

This is nonsense; the write() syscall does not have a blocking factor.
(dd and tar have blocking factors, but rsh does not maintain them.)

>The best way I've found to write through the network is to use fixed size
>blocks.  Make sure the program that is reading from the network knows the
>correct blocksize and doesn't assume it will all show up after one single
>read.  Multiple reads may (or may not) be neccessary
>
>Fortunately "dd" can do this:
>	dd bs=20b of=/dev/rmt8

`dd' can indeed do the trick, but not with the options you gave.  With
just a `bs' option and no conversions, dd defaults to copying the input
record size to its output, so that if it reads 32, then 1024, then 12
bytes, it writes 32, then 1024, then 12 bytes.

>The "tar" program has an option (-B) to force input/output blocking to 20 "so
>that tar can work across a communications channel where the blocking may not
>be maintained."

This only matters for input.  To make tapes that those without the B
flag can read, use

	% tar cf - trees | rsh tapehost "dd obs=20b of=/dev/tape_device"

To read a tape, the command

	% rsh tapehost "dd if=/dev/tape_device bs=32k" | tar xf -

suffices on 4.3BSD and recent SunOSes, since `f -' implies `B'; under
4.2BSD, you must write `... | tar xBf -', and without the B flag you
would have had to use

	% rsh tapehost "dd if=/dev/tape_device bs=32k" | dd obs=XXb | tar xf -

where `XX' is any value in 1..40.  `dd if=/dev/tape_device bs=32k'
could be replaced with any other program that copies its input to its
output without change, as long as that program reads large enough
blocks (as determined by the actual tape block size).  The local
re-blocking conversions (`dd obs=20b' on either host) can be made
somewhat more efficient by using a larger ibs as well:

	% tar cf - trees | rsh tapehost "dd ibs=20b obs=20b of=/dev/tape_device"

(20b = 10k = more than 4.2 and 4.3 BSD send across the net at any
one time by default).  Note that, as I mentioned above,

	dd bs=N

and

	dd ibs=N obs=N

have different meanings.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list