Is it possible to use a tape drive under OS X?

Does anyone here have any experience using tape drives under OS X? I have a variety of SCSI drives including LTO, DLT, Exabyte and DAT that I read and write under Solaris and Linux, mainly with the 'tar' and 'dd' commands. I want to do the same under OS X, however OS X does not appear to have the vital tools I am used to such as 'mt' to control the drives. Using a backup program such as Retrospect is not an option since the tapes need to be read on other Unix systems - I have distributed 'tar' written tapes to many other individuals without a problem but never to/from a Mac.

Fingers crossed,

Simon

Posted on Sep 20, 2005 2:48 AM

Reply
10 replies

Sep 20, 2005 3:03 AM in response to Simon Dean

I can't begin to imagine they wouldn't work. You can use [tar] from the command line with a destination to the tape device just like any Unix. You can set flags and options to control block size and several issues dealing with tape backups.

http://www.ss64.com/osx/tar.html

Of note:

The default device for [tar] in Darwin, is /dev/sa0 which should be a tape drive. With the environmental variable of 'TAPE' you can select a different device.

You can specify an argument for the `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') option whenever you use `tar'; this option determines the name of the archive file that `tar' will work on.

If you don't specify this argument, then `tar' will use a default, usually some physical tape drive attached to your machine. If there is no tape drive attached, or the default is not meaningful, then `tar' will print an error message. The error message might look roughly like one of the following:

tar: can't open /dev/rmt8 : No such device or address
tar: can't open /dev/rsmt0 : I/O error

Options

--atime-preserve Restore the access times on files which are writ-
ten to tape (note that this will change the
inode-change time!).

-L number
--tape-length number Change tapes after writing number * 1024 bytes.

-[0-7][lmh] Specify tape drive and density.

Environment

TAPE Changes gnutar's default tape drive (which is still
overridden by the -f flag).

Files

/dev/sa0 The default tape drive.

Sep 20, 2005 3:48 AM in response to Simon Dean

Darwin has 'rmt'

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/rmt.8.ht ml#//apple_ref/doc/man/8/rmt

which is used by 'dump'

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/dump.8.h tml

And, I think what you are looking for specifically would be covered by 'mtio'

http://man.netbsd.se/?find=mtio4161

The only manual page I found for mtio was on a netbsd forum, Darwin does not seem to include a man page for mtio, but it is referenced from the two Apple maintained man paged linked to above.

Sep 20, 2005 4:22 AM in response to psalmsmith

Hmm, OK, near as I can tell, the kind of direct access to hardware you are looking for is found in the I/O Toolkit. Looks like you'd have to write a kernal extension which you might be able to call from shell scripts. Terribly complicated but it'd get the job done. Perhaps someone from developer.apple.com could shed a little more light on the subject of what you should do in place of 'mt' in Darwin?

Sep 20, 2005 4:38 AM in response to psalmsmith

Looks like 'rmt' is the key, but several commands come into play that will be more difficult than simply using 'mt' I thing.

The flag -l# in conjunction with 'rmt' calls the lseek function

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/lseek.2. html#//apple_ref/doc/man/2/lseek

The -i flag calls ioctl

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/ioctl.2. html#//apple_ref/doc/man/2/ioctl

using 'rmt' to do what you are looking at may be 10fold more complicated than mt, but it looks like the only tool available to do so from here. 8-(

Jan 9, 2006 8:48 AM in response to Simon Dean

I no longer do any sort of programming so my knowledge may be out of date, but my understanding of the problem is this:

Most of the Unix utilities expect a familiar interface for accessing SCSI devices, like BSD's CAM interface. When Apple introduced OS X, they chose to create their own interface as part of IOKit, which none of the Unix tools understand. This is also why it's so hard to find a SCSI PC card that works under OS X, as the vendors had to rewrite all of their drivers that worked with the older SCSI Manager. So, until someone finds a way to emulate CAM or SCSI Generic on top of IOKit, we're kind of out of luck with regards to free utilities.

I say "free utilities" because, IIRC, "BRU" has it's own set of utilities like "tapectl" which can control SCSI changers from within OS X. See http://www.tolisgroup.com for more info.

As an aside, this has been a problem for me, as I have a large (200 disc) SCSI-attached jukebox that I can't use with my TiBook. Alas...

PowerBook G4 Mac OS X (10.4.3)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is it possible to use a tape drive under OS X?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.