System Administration Guide: Devices and File Systems

Copying Files to a Remote Tape Device

ProcedureHow to Copy Files to a Remote Tape Device (tar and dd)

  1. The following prerequisites must be met to use a remote tape drive:

    1. The local host name and optionally, the user name of the user doing the copy, must appear in the remote system's /etc/hosts.equiv file. Or, the user doing the copy must have his or her home directory accessible on the remote machine, and have the local machine name in $HOME/.rhosts.

      For more information, see the hosts.equiv(4) man page.

    2. An entry for the remote system must be in the local system's /etc/inet/hosts file or in the name service hosts file.

  2. To test whether you have the appropriate permission to execute a remote command, try the following:

    $ rsh remotehost echo test

    If test is echoed back to you, you have permission to execute remote commands. If Permission denied is echoed back to you, check your setup as described in Step 1.

  3. Change to the directory where you want to put the files.

  4. Insert the tape into the tape drive.

  5. Copy the files to a remote tape drive.

    $ tar cvf - filenames | rsh remote-host dd of=/dev/rmt/n obs=block-size
    tar cf

    Creates a tape archive, lists the files as they are archived, and specifies the tape device.


    Provides additional information about the tar file entries.

    - (Hyphen)

    Represents a placeholder for the tape device.


    Identifies the files to be copied. Separate multiple files with spaces.

    rsh | remote-host

    Pipes the tar command's output to a remote shell.

    dd of= /dev/rmt/n

    Represents the output device.


    Represents the blocking factor.

  6. Remove the tape from the drive. Write the names of the files on the tape label.

Example 28–12 Copying Files to a Remote Tape Drive (tar and dd)

# tar cvf - * | rsh mercury dd of=/dev/rmt/0 obs=126b
a answers/ 0 tape blocks
a answers/test129 1 tape blocks
a sc.directives/ 0 tape blocks
a sc.directives/sc.190089 1 tape blocks
a tests/ 0 tape blocks
a tests/test131 1 tape blocks
6+9 records in
0+1 records out

ProcedureHow to Extract Files From a Remote Tape Device

  1. Insert the tape into the tape drive.

  2. Change to a temporary directory.

    $ cd /var/tmp
  3. Extract the files from a remote tape device.

    $ rsh remote-host dd if=/dev/rmt/n | tar xvBpf -
    rsh remote-host

    Indicates a remote shell that is started to extract the files from the tape device by using the dd command.

    dd if=/dev/rmt/n

    Indicates the input device.

    | tar xvBpf -

    Pipes the output of the dd command to the tar command, which is used to restore the files.

  4. Verify that the files have been extracted.

    $ ls -l

Example 28–13 Extracting Files From a Remote Tape Drive

$ cd /var/tmp
$ rsh mercury dd if=/dev/rmt/0 | tar xvBpf -
x answers/, 0 bytes, 0 tape blocks
x answers/test129, 48 bytes, 1 tape blocks
20+0 records in
20+0 records out
x sc.directives/, 0 bytes, 0 tape blocks
x sc.directives/sc.190089, 77 bytes, 1 tape blocks
x tests/, 0 bytes, 0 tape blocks
x tests/test131, 84 bytes, 1 tape blocks
$ ls -l