Configuring and controlling a tape drive under AIX

The most common problem, when using a tape drive under AIX, is the "block size" parameter. Modifying it allows you to restore tapes a lot mor easily.

To do this, follow the steps outlined below:

Checking the current status and block size of a tape drive

Use the mt status command, as root, like this:

	root@galactus$ mt -f /dev/rmt0 status		
	rmt0 Available 04-08-00-2,0 LVD SCSI 4mm Tape Drive
	attribute     value description                          user_settable

	block_size    0     BLOCK size (0=variable length)       True
	compress      yes   Use data COMPRESSION                 True
	density_set_1 71    DENSITY setting #1                   True
	density_set_2 38    DENSITY setting #2                   True
	extfm         no    Use EXTENDED file marks              True
	mode          yes   Use DEVICE BUFFERS during writes     True
	ret           no    RETENSION on tape change or reset    True
	ret_error     no    RETURN error on tape change or reset True
	size_in_mb    36000 Size in Megabytes                    False

The parameter you should always check is the block_size. By default, it should be set to "0" to make sure the tape drive will automatically adapt to whatever block size has been used when performing the backup.

Setting the "block_size" parameter

Set the block_size parameter with the chdev (change device, of course) like this:

     root@galactus$ /usr/sbin/chdev -l rmt0 -a block_size=0

You can then use the mt command to control the tape, and the commands tar and restore to list the content of the tape itself.

     root@galactus$ mt -f /dev/rmt0 rewind 
     root@galactus$ mt -f /dev/rmt0 offline
     root@galactus$ /usr/sbin/restore -Tav -f /dev/rmt0
     Please mount volume 1 on /dev/rmt0.
             Press the Enter key to continue.
     New volume on /dev/rmt0:
     Cluster size is 51200 bytes (100 blocks).
     The volume number is 1.
     The backup date is: Thu Mar 29 16:48:41 DFT 2007
     Files are backed up by name.
     The user is root.
      755  ldap     203                 0 .
      640  ldap     ldap       8388681728 ./db_arc_v3.dump

Restoring one file out of an 'mksysb' tape:

All my thanks to TCH for his help on this one!

Here is the step-by-step nitty-gritty:

root@galactus$ /usr/sbin/chdev -l rmt0 -a block_size=512
$ tctl -f /dev/rmt0.1 fsf 3

Please note that the .1 device number is mandatory. If you are not using /dev/rmt0, substitute the correct device number.

$ restore -xvf /dev/rmt0.1 ./your/file/name

This is valid for all versions of AIX > 4. If you are using an old version of AIX, please see the link below, in the "See Also" section.

Hope this helps!

See Also: