Go to main content

Managing File Systems in Oracle® Solaris 11.3

Exit Print View

Updated: October 2017
 
 

Copying Files and File Systems to a Remote Tape Device

This section shows how to copy files and file systems to a remote tape device.

How to Copy Files to a Remote Tape Device Using tar and dd Commands

  1. Configure ssh on the remote system so that you can access the tape drive.

    For more information about configuring ssh, see Managing Secure Shell Access in Oracle Solaris 11.3.

  2. Change to the directory where you want to put the files.
  3. Insert the tape into the tape drive.
  4. Copy the files to a remote tape drive.
    $ tar cvf - filenames | ssh remote-host dd of=/dev/rmt/n obs=block-size
    –cf

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

    –v

    Provides additional information about the tar file entries.

    - (Hyphen)

    Represents a placeholder for the tape device.

    filenames

    Identifies the files to be copied. You can copy multiple files by specifying the file names with spaces.

    ssh | remote-host

    Pipes the output of the tar command to a remote system.

    dd of= /dev/rmt/n

    Represents the output device.

    obs=block-size

    Represents the blocking factor.

  5. Remove the tape from the drive. Write the names of the files on the tape label.
Example 27  Copying Files to a Remote Tape Drive Using the tar and dd Commands
# tar cvf - * | ssh mercury dd of=/dev/rmt/0 obs=126b
password:
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

How 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.
    $ ssh remote-host dd if=/dev/rmt/n | tar xvBpf -
    ssh remote-host

    Indicates a secure 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  Extracting Files From a Remote Tape Device
$ cd /var/tmp
$ ssh mercury dd if=/dev/rmt/0 | tar xvBpf -
password:
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

For more information, see the tar(1) and dd(1M) man pages.