System Administration Guide, Volume I

How to Copy All Files in a Directory to a Tape (cpio)

  1. Insert a tape that is not write-protected into the tape drive.

  2. Copy files to a tape using the ls and cpio commands.


    $ ls | cpio -oc > /dev/rmt/n
    

    ls

    Provides the cpio command with a list of file names.

    cpio -oc

    Specifies that cpio should operate in copy-out mode (-o) and write header information in ASCII character format (-c). This ensures portability to other vendor's systems.

    > /dev/rmt/n

    Specifies the output file. 

    All of the files in the directory are copied to the tape in the drive you specify, overwriting any existing files on the tape. The total number of blocks copied is displayed.

  3. Verify the files are copied to tape by using the following cpio command.


    $ cpio -civt < /dev/rmt/0
    
  4. Remove the tape from the drive and write the names of the files on the tape label.

Example--Copying All Files in a Directory to a Tape (cpio)

The following example copies all of the files in the directory /export/home/kryten to the tape in tape drive 0.


$ cd /export/home/kryten
$ ls | cpio -oc > /dev/rmt/0
8 blocks
$ cpio -civt < /dev/rmt/0
drwxr-xr-x  2 kryten  users    0   Jun  9 15:56 1998, letters
drwxr-xr-x  2 kryten  users    0   Jun  9 15:56 1998, memos
drwxr-xr-x  2 kryten  users    0   Jun  9 15:55 1998, reports
8 blocks
$