System Administration Guide: Basic Administration

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

  1. Change to the directory that contains the files you want to copy.

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

  3. Copy the files to a tape.


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

    ls

    Provides the cpio command with a list of file names.

    cpio -oc

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

    > /dev/rmt/n

    Specifies the output file. 

    All 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 that are copied is shown.

  4. Verify that the files are copied to tape.


    $ cpio -civt < /dev/rmt/n
    
  5. 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 shows how to copy all of the files in the /export/home/kryten directory to the tape in tape drive 0.


$ cd /export/home/kryten
$ ls | cpio -oc > /dev/rmt/0
92 blocks
$ cpio -civt < /dev/rmt/0
-rw------t    1 kryten     users        400 Jul 14 09:28 2001, b
drwx--x--x    2 kryten     users          0 Jul 14 09:26 2001, letters
-rw------t    1 kryten     users      10000 Jul 14 09:26 2001, letter1
-rw------t    1 kryten     users      10100 Jul 14 09:26 2001, letter2
-rw------t    1 kryten     users      11100 Jul 14 09:27 2001, letter3
-rw------t    1 kryten     users      12300 Jul 14 09:27 2001, letter4
drwx--x--x    2 kryten     users          0 Jul 14 09:27 2001, memos
-rw------t    1 kryten     users        400 Jul 14 09:28 2001, memosmemoU
-rw------t    1 kryten     users        500 Jul 14 09:28 2001, memosmemoW
-rw------t    1 kryten     users        100 Jul 14 09:27 2001, memosmemoX
-rw------t    1 kryten     users        200 Jul 14 09:28 2001, memosmemoY
-rw------t    1 kryten     users        150 Jul 14 09:28 2001, memosmemoZ
drwx--x--x    2 kryten     users          0 Jul 14 09:24 2001, reports
92 blocks
$