Change to the directory that contains the files you want to copy.
Insert a write-enabled tape into the tape drive.
Copy the files to tape.
$ ls | cpio -oc > /dev/rmt/n
Provides the cpio command with a list of file names.
Specifies that the cpio command should operate in copy-out mode (-o) and write header information in ASCII character format (-c). These options ensure portability to other vendors' systems.
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.
Verify that the files have been copied to tape.
$ cpio -civt < /dev/rmt/n
Specifies that the cpio command should read files in ASCII character format.
Specifies that the cpio command should operate in copy-in mode, even though the command is only listing files at this point.
Displays the output in a format that is similar to the output from the ls -l command.
Lists the table of contents for the files on the tape in the tape drive that you specify.
Specifies the input file of an existing cpio archive.
Remove the tape from the drive. Write the names of the files on the tape label.
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 1280 blocks $ cpio -civt < /dev/rmt/0 -r--r--r-- 1 kryten staff 206663 Jul 14 13:52 2010, filea -r--r--r-- 1 kryten staff 206663 Jul 14 13:52 2010, fileb -r--r--r-- 1 kryten staff 206663 Jul 14 13:52 2010, filec drwxr-xr-x 2 kryten staff 0 Jul 14 13:52 2010, letters drwxr-xr-x 2 kryten staff 0 Jul 14 13:52 2010, reports 1280 blocks