Solaris Handbook for Sun Peripherals

Chapter 3 Setting Up and Using a Tape Drive

This chapter describes how to configure and use tape drive devices with the SolarisTM operating environment.

This chapter contains the following information:

Requirements

Before you start to configure the operating environment for a new tape drive, you must:


Note -

If you did not follow the procedures in "Shut Down the System", the operating system may not recognize the new tape drive.


Tape Drives

Tape drives are used primarily to store data offline, often as a backup.

Once a new tape drive is connected to the system and booted properly, the tape drive is ready for use. Unlike disk drives, tape drives do not need to be formatted, labeled, or prepared in any special way.

Once the tape device is installed and the operating system is running, you refer to the tape device by the logical device name as described in the Table 3-1 below. For more information on logical device names refer to Appendix A, SCSI Addressing.

Table 3-1 Address and Logical Device Names for Tape Drives

Tape Drive 

SCSI Address Switch or Jumper Setting (Target ID)  

 Primary Logical Device Name Additional Logical Device Names

First tape drive 

4* 

/dev/rmt/0

/dev/rmt/0n   /dev/rmt/0h   /dev/rmt/0c   /dev/rmt/0ubn

Second tape drive 

5* 

/dev/rmt/1

/dev/rmt/1n   /dev/rmt/1h   /dev/rmt/1c /dev/rmt/1ubn

*Can be any unique address on the bus.

For most tape operations you should use the primary logical device name because the tape drive will use its optimum default characteristics. However, if you want to specify a particular tape drive behavior, append a letter to the appropriate logical device name as follows:

Valid tape names are shown in the table below. If you are working with the second tape drive use a 1 instead of 0.

0n   0b   0bn0c   0cb   0cbn   0cn0h 0hb 0hbn 0hbn0m   0mb   0mbn   0mn0l   0lb   0lbn   0ln0u   0ub   0ubn   0un

To Add a Tape Drive
  1. Shut down your system.

    See "Shut Down the System".

  2. Check that the address switch for the tape drive has been set correctly.

    The SCSI address switch for tape drives is typically preset by the factory to SCSI target ID 4. If you have more than one tape drive, you must set the SCSI address switch of the second tape drive to an address other than SCSI target ID 4 or any other target ID present on the bus.

    Refer to the documentation that came with your new tape device and to Appendix A, SCSI Addressing".


    Note -

    Connecting more than four tape drives to a single SCSI bus can cause slower system performance.



    Caution - Caution -

    Each tape drive must have a unique SCSI target ID setting. The SCSI address switches on your tape drives may need to be set to different numbers than those shown in Table 3-1. For further information on device addresses, see the System Administration Guide.


  3. Install the tape drive.

    For installation information, refer to the documentation that accompanies your hardware.

  4. Turn the power on to the system and all the peripheral devices.

    In most cases, this will cause the system to automatically boot. If the /reconfigure file is present (as described in "To Prepare the System"" in Chapter 1), then the operating system will automatically assign a logical device name and initialize the appropriate device drivers for the new device. If the /reconfigure file does not exist, you can achieve the same effect by performing a boot -r. See Appendix B, Booting Your System" for more information.

    Your new tape drive is ready for use.

Miscellaneous Tape Commands

To Display the Status of a Tape Drive
  1. Load a tape into the tape drive.

  2. Enter:


    % mt -f /dev/rmt/unit_number status
    

    This command locates the tape drive with the /dev/rmt/unit_number logical device name. It then displays the status of the tape drive. (See the examples below.)

    If you have more than one tape drive connected to your system use the appropriate logical device name such as /dev/rmt/0, /dev/rmt/1, or /dev/rmt/2, and so on.

    • Your system is able to access the tape drive and a tape cartridge is present, if the following status is displayed:


      Exabyte EXB-8200 8mm tape drive:
        sense key(0x0)= nosense     residual= 0 retries= 0
        file no= 0    block no= 0
      

      sense key= nosense indicates that your system was able to access the tape and there were no errors. You can then use any of the backup commands described in the following sections.

    • The following information tells you that the tape drive was just reset, powered on, or a tape cartridge was recently installed.


      Exabyte EXB-8200 8mm tape drive:
        sense key(0x6)= unit attention      residual= 0 retries=
      0
        file no= 0    block no=0
      

    In this case, execute the mt -f /dev/rmt/0 status command again until the sense key(0x6)= unit attention advisory message is replaced with the sense key(0x0)= nosense message.

    • If the following status is displayed, your system is unable to access the tape.


      /dev/rmt/0: no tape loaded or drive offline
      

      In this case, insert a tape and execute the mt -f /dev/rmt/0 status command again.

    • If the following status is displayed, your system is unable to communicate with the tape drive.


      no such file or directory
      

    In this case, verify that the tape drive is powered on and is properly connected to the system. If the same message appears try rebooting the system as described in "To Boot After Connecting a Peripheral Device".

To Tension a 1/4-inch Tape Cartridge

When you insert a blank tape cartridge into a 1/4-inch tape drive, you should perform a tensioning pass. This procedure runs the tape from one end to the other and ensures an even distribution of tension throughout the tape cartridge.


Note -

The retensioning command is not supported for Digital Data Storage (DDS) or 8mm devices.


  1. Insert the cartridge tape into the tape drive.

  2. Type:


    % mt -f /dev/rmt/unit_number retension
    

To Rewind a Tape
  1. Type:


    % mt -f /dev/rmt/unit number rewind
    

To Clean a Tape Drive

Tape drives must be cleaned periodically. To clean a tape drive:

  1. Insert a cleaning cartridge into the tape drive.

    Consult your hardware documentation for details.

Tape Utilities

There are many utilities that are used to read or write data to a tape drive. This section covers some of the common tape utilities that come with the Solaris operating environment. If you have purchased an additional tape or backup utility please refer to that documentation.

The following commands are covered in this section:


Note -

If you have a 5.0 Gbyte 4mm DDS device, use a blocking factor of 96 instead of the default factor of 20 to optimize performance. The blocking factor of 96 translates to 48 Kbytes per transfer. For the 150 Mbyte 1/4-inch tape drive, the 2.3 Gbyte 8mm tape drive, the 5.0 Gbyte 8mm tape drive, and the Front-Load 1/2-inch tape drive, use a blocking factor of 126 instead of the default factor of 20 to optimize performance. Blocking factors are specified as options on the command line of the tape utility command that you choose to use.


cpio Command

The cpio command (copy in/out) copies a list of files between devices by taking a list of names from standard input and writing to standard output. It is a versatile command but requires you to redirect standard-in and standard-out. cpio can be used when the amount of data requires the use of more that one volume (tape cartridge).

Example 1:

The following example shows how to copy the files in your working directory called /work and all subdirectories to the first tape drive with the logical device name of /dev/rmt/0.


example# cd /work
example# ls -R | cpio -ocB > /dev/rmt/0

Example 2:

The next example shows how to copy the files that are located on your tape back to your hard disk:


example# cd /work
example# cpio -icdB < /dev/rmt/0


Note -

You must use the same blocking factor when you retrieve or copy files from the tape to the hard disk as you did when you copied files from the hard disk to the tape. In such cases you must specify the B option.


dd Command

This command converts and copies files with different data formats. One usage of this command is to transfer a file system or partition from your hard disk to a tape. You can also use it to copy files from one hard disk to another. If you use a device with a variable block size, you need to make sure that you use the same block size when you retrieve the data.

The following example shows how to write the file system or partition /user/sunsystem to a 4mm tape drive with a tape drive called /dev/rmt/0. The blocking factor is 96 in this example. This example has been optimized for a 5.0 Gbyte 4mm DDS device.

Example:


example# dd if=/dev/dsk/c0t0d0s7 of=/dev/rmt/0 bs=96k

ufsdump Command

The ufsdump command copies a file system or directory from a hard disk to a tape. It is specifically designed as a backup utility. It supports multiple volumes, and incremental backups. For more information about incremental dump levels and schedules, see the System Administration Guide.


Note -

All files must be part of one file system or one partition and you must be superuser.


Example:

The following example shows how to copy all files that are located on a disk drive in partition /dev/rdsk/c0t3d0s0 to a dump file (that represents the tape drive in this case) called /dev/rmt/1.


example# ufsdump 0ubf 96 /dev/rmt/1 /dev/rdsk/c0t1d0s0

ufsrestore Command

The ufsrestore command copies file systems from a tape to a hard disk. It can only copy file systems that were created with the ufsdump command.

You must use ufsrestore with one of these three options:

The following options are not mandatory:

Example:

The following example shows how to retrieve a file from tape interactively. The file will be written in the current directory (/disk2 in this example). A blocking factor of 96 is specified as well as the dump file (first tape drive) of /dev/rmt/0.


Note -

You must use the same blocking factor (or larger) when you retrieve or copy files from the tape to the hard disk as you did when you copied files from the hard disk to the tape.



example# cd /disk2
example# ufsrestore ibf 96 /dev/rmt/0
ufsrestore > ?
Available commands are:
  ls [arg] - list directory
  cd arg - change directory
  pwd - print current directory
  add [arg] - add `arg' to list of files to be extracted
  delete [arg] - delete `arg' from list of files to be
extracted
  extract - extract requested files
  setmodes - set modes of requested directories
  quit - immediately exit program
  what - list dump header information
  verbose - toggle verbose flag (useful with "ls")
  help or `?' - print this list
IF no `arg' is supplied, the current directory is used

The system responds with a ufsrestore prompt. If you type a question mark, a list of available arguments is displayed.

List the directories that are resident on the tape by typing ls.


ufsrestore > ls
4lib/     dict        mail    openwin      spool
5bin      games       man/    preserve     src
adm       include/    net     pub          tmp

Now add the files or directories to the list of files to extract with the add command:


ufsrestore > add man mail

In this example the man and mail files are added to the list of files to extract from tape.

Now extract these files from the tape. They will be written to your current working directory (/disk2 in this example).


ufsrestore > extract

Once all the desired files are extracted, exit the ufsrestore command with q:


ufsrestore > q

tar Command

The tar command archives and retrieves files to and from a single file called a tarfile. A tarfile is usually a tape, but it can be any file. If the amount of data exceeds one tape then you need to use a different tape command because tar cannot span multiple volumes (tapes).

Example 1:

The following example shows how to copy files from a hard disk to a tape.


example# tar cvbf 96 /dev/rmt/1 ./directory

In this example, the tar command copies files from a directory to a tape drive with the device name of /dev/rmt/1. Specifying the directory source preceded with a ./ will cause the files to be recorded as relative path names. Later, when the files are extracted, they files will be written back into the file system based on your current working directory.

Example 2:

The next example shows how to copy files from a tape to the current working directory on a hard disk. It is very important to change to the directory where the extracted files will reside before running tar.


example# cd /tmp
example# tar xvbf 96 /dev/rmt/1


Note -

You must use the same blocking factor (or larger) when you retrieve or copy files from the tape to the hard disk as you did when you copied files from the hard disk to the tape.