Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

What Is in the Archive?

When you have an archive on a removable device, you might not know what is on it. Perhaps you are using a multiple-level backup scheme and you don't know which day the file was backed up. Both tar and cpio offer a way of creating a table of contents for the tape. The most convenient time to create this TOC file, of course, is during the actual backup. The following two lines show how to perform a backup and at the same time create a table of contents file for that archive:


   $ tar cvf - / > /tmp/backup.Monday.TOC

   $ find / -print | cpio -ov > /dev/rmt0 2> /tmp/backup.Monday.TOC

The cpio backup automatically sends the list to standard error; therefore, this line just captures standard error and saves it as a file. By the way, if the > in the cpio command is replaced with the word tee, the table of contents is not only written to the file; it is also printed to standard output (the screen). Use a command such as:


   $ find / -print | cpio -ov | tee >/dev/rmt0 2>/tmp/backup.Monday.TOC

Share ThisShare This

Informit Network