System Administration Guide, Volume 1

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 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 shown.

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