[Sunhelp] Tape Drive -- Block or Raw Device?

Doug McLaren dougmc at frenzy.com
Mon Aug 9 14:30:25 CDT 1999


On Mon, Aug 09, 1999 at 11:22:50AM -0500, He Gang-W1268C wrote:

| I would say it's block device. 

I would say it's not.  It's a character device.

   % ls -la /dev/rmt/0mn 
   lrwxrwxrwx   1 root     root           51 Sep 29  1997 /dev/rmt/0mn -> ../../devices/sbus at 3,0/SUNW,fas at 3,8800000/st at 4,0:mn

   % ls -la /devices/sbus at 3,0/SUNW,fas at 3,8800000/st at 4,0:mn
   crw-rw-rw-   1 root     sys       33, 140 Sep 29  1997 /devices/sbus at 3,0/SUNW,fas at 3,8800000/st at 4,0:mn

That `c' means character device.  For comparison, a block device would
look like this -

   % ls -la /devices/sbus at 3,0/SUNW,fas at 3,8800000/sd at 0,0:a
   brw-r-----   1 root     sys       32,   0 Sep 26  1997 /devices/sbus at 3,0/SUNW,fas at 3,8800000/sd at 0,0:a

The distinction is that with a block device you can seek around and
access any block.  It's random access.  Think of a hard disk or a
cdrom.

A character device doesn't offer random access.  You access it as a
stream of data.  With a tape drive you do have a little more
flexibility, as you *can* seek around the tape, but it's not
transparant - instead of using the seek() system calls, you have to
send the tape drive commands to do what you want it to do.

There are device drivers out there that can make a block device out of
a tape drive, but they're typically r e a l l y slow and are rarely
used.

Other character devices would be a virtual console, a serial port, a
keyboard/mouse, a printer, etc.

The `blocking factor' that you're referring to is merely the number of
bytes written or read at a time.  It doesn't mean it's a block device.

...
| Is a tape drive a block device or a raw (character) device?  
|  
| If it matters any, my confusion is due to the fact that I can
| specify a blocking factor when using the cpio or tar commands.
|  
| Thanks to everyone who takes the time to read and respond to
| my question.
|  
| Trevor C.

---
Doug McLaren, dougmc at frenzy.com






More information about the SunHELP mailing list