Subject: Re: A few mt(1) questions
To: Aaron J. Grier <agrier@poofygoof.com>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: netbsd-users
Date: 03/19/2002 02:18:25
On Mon, 18 Mar 2002, Aaron J. Grier wrote:

> On Mon, Mar 18, 2002 at 11:28:52PM -0500, Brian A. Seklecki wrote:
>
> > There's got to be an easier way to do it [estimate tape size] using a
> > standard set of tools (dd, cpio, dump, tar, etc.).  I'll figure it out
> > eventually.  I'm presently scouring Google and other mailing list
> > archives.
>
> dd if=/dev/zero of=/dev/rmt0

Doh!  Not thinking.  I'll try the raw device.  I checked mtio(4), which is
is hard to decypher having never done (read) "Advanced Prgramming in the
UNIX Environment".

UNIX TAPE I/O
     Regardless of the specific characteristics of the particular tape
trans- port mechanism (tape drive), UNIX tape I/O has two interfaces:
"block" and "raw".  I/O through the block interface of a tape device is
similar to I/O through the block special device for a disk driver: the
individual read(2) and write(2) calls can be done in any amount of bytes,
but all data is buffered through the system buffer cache, and I/O to the
device is done in 1024 byte sized blocks.  This limitation is sufficiently
re- strictive that the block interface to tape devices is rarely used.

     The "raw" interface differs in that all I/O can be done in arbitrary
sized blocks, within the limitations for the specific device and device
driver, and all I/O is synchronous.  This is the most flexible interface,
but since there is very little that is handled automatically by the ker-
nel, user programs must implement specific magnetic tape handling
routines, which puts the onus of correctness on the application
programmer.

> does the trick for me under 1.4 and 1.5 on my pmaxen with TZK10 QIC

/dev/rmt0?  What interface is that? I don't have that device in sparc and
it's not in MAKEDEV.  Is that the device for non-scsi tapes (ATAPI, etc?)

> drive.  I could've sworn I also did this on i386 with an exabyte as
> well.  maybe using the raw device is the trick?